Skip to content

startOfTime

startOfTime(value: string, unit: any, optionsArg?: { fractionalSecondDigits?: FractionalDigit; }): string
import { 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.
Parameter Type Description
value string ISO 8601 time string
unit any StartOfTimeUnit to specify the unit for the start

options

Option Type Default
fractionalSecondDigits? FractionalDigit

ISO 8601 string representing the start of the specified unit, or “” on invalid input

startOfTime("12:34:56", "hour") // "12:00:00"
startOfTime("invalid", "hour") // ""

plain/calculate/startOfTime.ts