endOfDateTime
Signature
Section titled “Signature”endOfDateTime(value: string, unit: any, optionsArg?: { weekStartsOn?: "monday" | "sunday"; fractionalSecondDigits?: FractionalDigit; }): stringimport { endOfDateTime } from "@northguild/gmt/plain/calculate";Return the end 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 end |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
weekStartsOn? |
"monday" | "sunday" |
— |
fractionalSecondDigits? |
FractionalDigit |
— |
Returns
Section titled “Returns”ISO 8601 string representing the end of the specified unit, or “” on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”endOfDateTime("2024-02-29T12:34:56", "month") // "2024-02-29T23:59:59.999999999"endOfDateTime("invalid-date", "month") // ""