Fundamentals
    Preparing search index...

    Class TimeOnly

    Represents a time of day with no date and no time zone.

    Deliberately not a JavaScript Date. A Date needs a date, and a time of day has none: new Date('14:30:45') is not an instant pinned to some default day, it is Invalid Date. The value is destroyed outright rather than merely shifted, which makes this the starker of the two temporal cases.

    Index
    hour: number

    The hour, 0 through 23.

    millisecond: number

    The millisecond, 0 through 999.

    minute: number

    The minute, 0 through 59.

    second: number

    The second, 0 through 59.

    "[typeKey]": "TimeOnly" = 'TimeOnly'
    • Determines whether this is the same time of day as another.

      Parameters

      • other: TimeOnly | null | undefined

        The other time.

      Returns boolean

      True when they are the same time.

    • Gets the ISO-8601 representation, HH:mm:ss - or HH:mm:ss.fff when there is a fractional part.

      Returns string

      The string.

    • Creates a TimeOnly from its parts.

      Parameters

      • hour: number

        The hour.

      • minute: number

        The minute.

      • second: number = 0

        The second.

      • millisecond: number = 0

        The millisecond.

      Returns TimeOnly

      The TimeOnly.

    • Parses the ISO-8601 time of day the server sends, HH:mm, HH:mm:ss or HH:mm:ss.fffffff.

      Parameters

      • value: string

        The value to parse.

      Returns TimeOnly

      The TimeOnly.

      The seconds and the fraction are both optional because the server omits them when they are zero, and the fraction carries up to seven digits where JavaScript holds three - so it is truncated rather than rounded, which keeps a parse followed by a render from moving the value forward.