isZonedRelativeDay
Signature
Section titled “Signature”isZonedRelativeDay(value: string, offsetDays: number): booleanReturn true when value’s local calendar day falls offsetDays days from today in value’s own IANA timeZone.
- Subsumes
isZonedToday/isZonedYesterday/isZonedTomorrow:offsetDays: 0is “today”,-1is “yesterday”,1is “tomorrow”, and any other integer offset works the same way. - “Today” is resolved in
value’s own timeZone — no separate timeZone argument needed, sincevaluealready carries its IANA timeZone. This is the deterministic counterpart toisRelativeDay, which depends on the system clock and system timeZone: the same instant is “today” inPacific/Apiaand “yesterday” inPacific/Niue, a 24-hour spread. offsetDaysmust be an integer; non-integer or non-finite values return false.- Returns false if
valueis invalid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO ZonedDateTime string |
offsetDays | number | integer number of days from today in value’s own timeZone |
Returns
Section titled “Returns”true if value’s local day is exactly offsetDays days from today in its own timeZone, false on invalid input
Examples
Section titled “Examples”import { isZonedRelativeDay } from "@northguild/gmt/zoned/compare";
isZonedRelativeDay("2024-03-15T10:00:00-04:00[America/New_York]", 0) // true, if today is 2024-03-15 in America/New_York