* Compares two dates. * @param first The first date to compare. * @param second The second date to compare. * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier, * a number greater than 0 if the first date is later.
(first: D, second: D)
| 292 | * a number greater than 0 if the first date is later. |
| 293 | */ |
| 294 | compareDate(first: D, second: D): number { |
| 295 | return ( |
| 296 | this.getYear(first) - this.getYear(second) || |
| 297 | this.getMonth(first) - this.getMonth(second) || |
| 298 | this.getDate(first) - this.getDate(second) |
| 299 | ); |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Compares the time values of two dates. |