MCPcopy Create free account
hub / github.com/ether/etherpad / nextWindowStart

Function nextWindowStart

src/node/updater/MaintenanceWindow.ts:95–105  ·  view source on GitHub ↗
(now: Date, window: MaintenanceWindow)

Source from the content-addressed store, hash-verified

93 * collapse to `now`. Fire-now is gated by `inWindow`, not this function.
94 */
95export const nextWindowStart = (now: Date, window: MaintenanceWindow): Date => {
96 const s = toMinutes(window.start);
97 if (s == null) return now;
98 const isUtc = window.tz === 'utc';
99 const year = isUtc ? now.getUTCFullYear() : now.getFullYear();
100 const month = isUtc ? now.getUTCMonth() : now.getMonth();
101 const day = isUtc ? now.getUTCDate() : now.getDate();
102 const todayStart = buildAt(year, month, day, s, window.tz);
103 if (todayStart.getTime() > now.getTime()) return todayStart;
104 return buildAt(year, month, day + 1, s, window.tz);
105};

Callers 4

decideScheduleFunction · 0.90
decideTriggerApplyFunction · 0.90
expressCreateServerFunction · 0.90

Calls 2

toMinutesFunction · 0.85
buildAtFunction · 0.85

Tested by

no test coverage detected