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

Function useTimeHelpers

frontend/src/utils/dateTimeUtils.js:140–158  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138};
139
140export const useTimeHelpers = () => {
141 const timeZone = useUserTimeZone();
142
143 const toUserTime = useCallback(
144 (value) => {
145 if (!value) return dayjs(null);
146 try {
147 return initializeTime(value).tz(timeZone);
148 } catch (error) {
149 return initializeTime(value);
150 }
151 },
152 [timeZone]
153 );
154
155 const userNow = useCallback(() => getNow().tz(timeZone), [timeZone]);
156
157 return { timeZone, toUserTime, userNow };
158};
159
160export const RECURRING_DAY_OPTIONS = [
161 { value: 6, label: 'Sun' },

Callers 4

RecordingDetailsModalFunction · 0.90
RecurringRuleModalFunction · 0.90
RecordingCardFunction · 0.90
DVRPageFunction · 0.90

Calls 3

useUserTimeZoneFunction · 0.85
initializeTimeFunction · 0.85
getNowFunction · 0.85

Tested by

no test coverage detected