(date1: Date | number, date2: Date | number)
| 8 | } |
| 9 | |
| 10 | export function compareMonth(date1: Date | number, date2: Date | number) { |
| 11 | if (!(date1 instanceof Date)) { |
| 12 | date1 = new Date(date1); |
| 13 | } |
| 14 | |
| 15 | if (!(date2 instanceof Date)) { |
| 16 | date2 = new Date(date2); |
| 17 | } |
| 18 | |
| 19 | const year1 = date1.getFullYear(); |
| 20 | const year2 = date2.getFullYear(); |
| 21 | const month1 = date1.getMonth(); |
| 22 | const month2 = date2.getMonth(); |
| 23 | |
| 24 | if (year1 === year2) { |
| 25 | return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; |
| 26 | } |
| 27 | |
| 28 | return year1 > year2 ? 1 : -1; |
| 29 | } |
| 30 | |
| 31 | export function compareDay(day1: Date | number, day2: Date | number) { |
| 32 | if (!(day1 instanceof Date)) { |
no outgoing calls
no test coverage detected