| 19 | * this year. |
| 20 | */ |
| 21 | export 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 | |
| 38 | function isValidDate(date: unknown): date is Date { |
| 39 | return date instanceof Date && !isNaN(date.getTime()); |