MCPcopy
hub / github.com/date-fns/date-fns / getDstTransitions

Function getDstTransitions

pkgs/core/src/_lib/test/tzOffsetTransitions.ts:21–36  ·  view source on GitHub ↗
(year: number)

Source from the content-addressed store, hash-verified

19 * this year.
20 */
21export function getDstTransitions(year: number): PartialInterval {
22 const result: PartialInterval = {
23 start: undefined,
24 end: undefined,
25 };
26 const transitions = getTzOffsetTransitions(year);
27 for (let i = 0; i < transitions.length; i++) {
28 const t = transitions[i];
29 const month = t.date.getMonth();
30 if (month > 0 && month < 11) {
31 if (t.type === "forward") result.start = t.date;
32 if (t.type === "back" && !result.end) result.end = t.date;
33 }
34 }
35 return result;
36}
37
38function isValidDate(date: unknown): date is Date {
39 return date instanceof Date && !isNaN(date.getTime());

Callers 6

test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90

Calls 1

getTzOffsetTransitionsFunction · 0.85

Tested by

no test coverage detected