MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / roundToNearest

Function roundToNearest

frontend/src/utils/dateTimeUtils.js:111–119  ·  view source on GitHub ↗
(dateTime, minutes)

Source from the content-addressed store, hash-verified

109export const getNowMs = () => Date.now();
110
111export const roundToNearest = (dateTime, minutes) => {
112 const current = initializeTime(dateTime);
113 const minute = current.minute();
114 const snappedMinute = Math.round(minute / minutes) * minutes;
115
116 return snappedMinute === 60
117 ? current.add(1, 'hour').minute(0)
118 : current.minute(snappedMinute);
119};
120
121export const useUserTimeZone = () => {
122 const settings = useSettingsStore((s) => s.settings);

Callers 2

calculateScrollPositionFunction · 0.90
createRoundedDateFunction · 0.90

Calls 1

initializeTimeFunction · 0.85

Tested by

no test coverage detected