Skip to content

endOfTime

endOfTime(value: string, unit: any, optionsArg?: { fractionalSecondDigits?: FractionalDigit; }): string
import { endOfTime } from "@northguild/gmt/plain/calculate";

Return the end 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 EndOfTimeUnit to specify the unit for the end

options

Option Type Default
fractionalSecondDigits? FractionalDigit

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

endOfTime("12:34:56", "hour") // "12:59:59.999999999"
endOfTime("invalid", "hour") // ""

plain/calculate/endOfTime.ts