( t: number )
| 42 | } |
| 43 | |
| 44 | export function MonthFromTime( |
| 45 | t: number |
| 46 | ): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 { |
| 47 | const dwy = DayWithinYear(t) |
| 48 | const leap = InLeapYear(t) |
| 49 | if (dwy >= 0 && dwy < 31) return 0 |
| 50 | if (dwy < 59 + leap) return 1 |
| 51 | if (dwy < 90 + leap) return 2 |
| 52 | if (dwy < 120 + leap) return 3 |
| 53 | if (dwy < 151 + leap) return 4 |
| 54 | if (dwy < 181 + leap) return 5 |
| 55 | if (dwy < 212 + leap) return 6 |
| 56 | if (dwy < 243 + leap) return 7 |
| 57 | if (dwy < 273 + leap) return 8 |
| 58 | if (dwy < 304 + leap) return 9 |
| 59 | if (dwy < 334 + leap) return 10 |
| 60 | if (dwy < 365 + leap) return 11 |
| 61 | throw new Error('Invalid time') |
| 62 | } |
| 63 | |
| 64 | export function DateFromTime(t: number): number { |
| 65 | const dwy = DayWithinYear(t) |
no test coverage detected