parseWeekFromUtc
Signature
Section titled “Signature”parseWeekFromUtc(value: string, optionsArg?: { weekStartsOn?: "monday" | "sunday"; }): numberimport { parseWeekFromUtc } from "@northguild/gmt/utc/parse";Return the week number from a UTC datetime string.
- By default uses ISO weeks (Monday-based).
- Returns null for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO UTC datetime string (e.g., “2024-03-17T14:30:45Z”) |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
weekStartsOn? |
"monday" | "sunday" |
— |
Returns
Section titled “Returns”Week number (1-53) or null on invalid input
Examples
Section titled “Examples”parseWeekFromUtc("2024-03-17T14:30:45Z") // 11parseWeekFromUtc("invalid") // null