startOfTime
Signature
Section titled “Signature”startOfTime(value: string, unit: any, optionsArg?: { fractionalSecondDigits?: FractionalDigit; }): stringimport { startOfTime } from "@northguild/gmt/plain/calculate";Return the start of the specified time unit for a given ISO 8601 time string.
- Returns “” for invalid inputs.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO 8601 time string |
unit |
any |
StartOfTimeUnit to specify the unit for the start |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
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”startOfTime("12:34:56", "hour") // "12:00:00"startOfTime("invalid", "hour") // ""