weekOfYearForDateTime
Signature
Section titled “Signature”weekOfYearForDateTime(value: string): numberimport { weekOfYearForDateTime } from "@northguild/gmt/plain/calculate";Return the ISO week number for a given ISO 8601 datetime string.
- Uses Temporal.PlainDate.weekOfYear (Monday-based ISO weeks).
- Returns null for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO 8601 datetime string |
Returns
Section titled “Returns”Week number (1-53) or null on invalid input
Examples
Section titled “Examples”weekOfYearForDateTime("2024-01-01T12:00:00") // 1weekOfYearForDateTime("2024-01-08T00:00:00") // 2weekOfYearForDateTime("invalid") // null