getLocaleZonedDayOfWeek
Signature
Section titled “Signature”getLocaleZonedDayOfWeek(value: string, locale: string): numberimport { getLocaleZonedDayOfWeek } from "@northguild/gmt/zoned/calculate";Return the locale-relative day-of-week index for a zoned value.
0= the locale’s first day of week (e.g. Sunday for en-US, Monday for fr-FR).- Resolves the locale’s first day of week via
Intl.Locale.prototype.weekInfo. - Falls back to Monday if the runtime’s
weekInfodata doesn’t resolve a first day for the locale. - Returns
nullifvalueis not a valid zoned ISO datetime orlocaleis unresolvable.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
zoned ISO 8601 datetime string |
locale |
string |
BCP 47 locale tag (e.g. “en-US”, “fr-FR”) |
Returns
Section titled “Returns”locale-relative day-of-week index (0–6) or null on invalid input
Examples
Section titled “Examples”getLocaleZonedDayOfWeek("2024-02-25T12:00:00+00:00[UTC]", "en-US") // 0 (Sunday)getLocaleZonedDayOfWeek("2024-02-26T12:00:00+00:00[UTC]", "en-US") // 1 (Monday)getLocaleZonedDayOfWeek("2024-02-26T12:00:00+00:00[UTC]", "fr-FR") // 0 (Monday)getLocaleZonedDayOfWeek("invalid-zoned", "en-US") // nullgetLocaleZonedDayOfWeek("2024-02-26T12:00:00+00:00[UTC]", "not-a-locale") // null