endOfDate
Signature
Section titled “Signature”endOfDate(value: string, unit: Temporal.DateUnit, optionsArg?: { weekStartsOn?: "monday" | "sunday"; }): stringimport { endOfDate } from "@northguild/gmt/plain/calculate";Return the end of the specified date unit for a given ISO 8601 date string.
- Returns “” for invalid inputs.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO 8601 date string |
unit |
Temporal.DateUnit |
Temporal.DateUnit to specify the unit for the end |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
weekStartsOn? |
"monday" | "sunday" |
— |
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”endOfDate("2024-02-29", "month") // "2024-02-29"endOfDate("invalid-date", "month") // ""