You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {string | object | array } dateInput - Input date in one of ISO date string, keyed object, array of [day, month, year], [month, year], or {month, year}
446
+
* Calculate the number of days since a given date (positive = past, negative = future)
447
+
*
448
+
* @param {string | object | Array} dateInput - ISO date string, array [day, month, year], or object {day, month, year}
441
449
* @param {string | Dayjs | null} [compareDate] - Optional reference date (defaults to today)
442
-
* @returns {number} Number of days since the date (positive integer for past dates)
450
+
* @returns {number} Days since the date (positive for past dates)
451
+
* @example
452
+
* daysSince('2026-03-05') // 7 (if today is 2026-03-12)
453
+
* daysSince('2026-03-15') // -3 (future date)
443
454
*/
444
455
constdaysSince=(dateInput,compareDate=null)=>{
445
456
if(!dateInput)return0
@@ -592,10 +603,11 @@ const now = () => {
592
603
}
593
604
594
605
/**
595
-
* Format a date range
606
+
* Format a date range, collapsing shared day/month/year as appropriate
596
607
*
597
-
* @param {string} startDate - ISO date string
598
-
* @param {string} endDate - ISO date string
608
+
* @param {string} startDate - ISO date string for range start
609
+
* @param {string} endDate - ISO date string for range end
610
+
* @returns {string} Formatted range, e.g. '1 - 5 March 2026' or '1 March - 5 April 2026'
0 commit comments