getLocaleEndOfWeek
Signature
Section titled “Signature”getLocaleEndOfWeek(value: string, locale: string | string[]): stringReturn the end of the week containing value, using locale’s first day of week (e.g. fr-FR: week ends Sunday, ja-JP: week ends Saturday).
- Resolves the locale’s first day of week via
Intl.Locale.prototype.weekInfo. - Falls back to Monday-start (so the week ends Sunday) if the runtime’s
weekInfodata doesn’t resolve a first day for the locale. - Distinct from
endOfDate(value, "week", { weekStartsOn }), which takes an explicit ISO-biasedweekStartsOnoption instead of deriving it from a locale. - Returns "" if
valueis invalid orlocaleis not a well-formed BCP 47 tag (ECMA-402IsWellFormedLanguageTag). A well-formed tag with no matching locale data is not an error: it falls back to the host’s default locale, as ECMA-402ResolveLocalerequires.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO 8601 date string |
locale | string | string[] | BCP 47 locale tag (e.g. “fr-FR”, “ja-JP”, “en-US”), or a preference list of tags (ECMA-402; the first with locale data is read). Required: omitted, or an empty list (which ECMA-402 would resolve to the host default), returns "" |
Returns
Section titled “Returns”ISO 8601 date string for the end of value’s locale-relative week, or "" on invalid input
Examples
Section titled “Examples”import { getLocaleEndOfWeek } from "@northguild/gmt/plain/calculate";
getLocaleEndOfWeek("2024-02-29", "ja-JP") // "2024-03-02" (Saturday)Source
Section titled “Source”Accessibility
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.