| 3503 | } |
| 3504 | |
| 3505 | function monthDiff (a, b) { |
| 3506 | // difference in months |
| 3507 | var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), |
| 3508 | // b is in (anchor - 1 month, anchor + 1 month) |
| 3509 | anchor = a.clone().add(wholeMonthDiff, 'months'), |
| 3510 | anchor2, adjust; |
| 3511 | |
| 3512 | if (b - anchor < 0) { |
| 3513 | anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); |
| 3514 | // linear across the month |
| 3515 | adjust = (b - anchor) / (anchor - anchor2); |
| 3516 | } else { |
| 3517 | anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); |
| 3518 | // linear across the month |
| 3519 | adjust = (b - anchor) / (anchor2 - anchor); |
| 3520 | } |
| 3521 | |
| 3522 | return -(wholeMonthDiff + adjust); |
| 3523 | } |
| 3524 | |
| 3525 | utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; |
| 3526 | |