startOfDateTime
Signature
Section titled “Signature”startOfDateTime(value: string, unit: any, optionsArg?: { weekStartsOn?: "monday" | "sunday"; fractionalSecondDigits?: FractionalDigit; }): stringimport { startOfDateTime } from "@northguild/gmt/plain/calculate";Return the start of the specified date-time unit for a given ISO 8601 datetime string.
- Returns “” for invalid inputs.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO 8601 datetime string |
unit |
any |
Temporal.DateUnit|Temporal.TimeUnit to specify the unit for the start |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
weekStartsOn? |
"monday" | "sunday" |
— |
fractionalSecondDigits? |
FractionalDigit |
— |
Returns
Section titled “Returns”ISO 8601 string representing the start of the specified unit, or “” on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”startOfDateTime("2024-02-29T12:34:56", "month") // "2024-02-01T00:00:00"startOfDateTime("invalid-datetime", "month") // ""