(date1, date2)
| 22 | } |
| 23 | |
| 24 | export function compareMonth(date1, date2) { |
| 25 | if (!(date1 instanceof Date)) { |
| 26 | date1 = getDate(date1); |
| 27 | } |
| 28 | |
| 29 | if (!(date2 instanceof Date)) { |
| 30 | date2 = getDate(date2); |
| 31 | } |
| 32 | |
| 33 | const year1 = date1.getFullYear(); |
| 34 | const year2 = date2.getFullYear(); |
| 35 | const month1 = date1.getMonth(); |
| 36 | const month2 = date2.getMonth(); |
| 37 | |
| 38 | if (year1 === year2) { |
| 39 | return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; |
| 40 | } |
| 41 | |
| 42 | return year1 > year2 ? 1 : -1; |
| 43 | } |
| 44 | |
| 45 | export function compareDay(date1, date2) { |
| 46 | if (!(date1 instanceof Date)) { |
no test coverage detected