Skip to content

Documentation / jalali-js / compareDates

Function: compareDates()

compareDates(a, b): number

Defined in: date-math.ts:41

Compares a and b chronologically within the same calendar system: negative when a is earlier, positive when a is later, zero when they name the same day. Plain (year, month, day) comparison, not a Julian Day Number round trip: year dominates month dominates day for any calendar system this project supports, so lexicographic comparison is already correct and does not need a conversion (verified against Julian Day Number ordering directly; see date-math.test.ts).

Parameters

a

CalendarDateFields

b

CalendarDateFields

Returns

number