node-cooper - v0.2.0
    Preparing search index...

    Class default

    An offset datetime -- CASC.md §6.6's 1979-05-27T07:32:00Z or 1979-05-27T07:32:00.120+05:30: a real instant. Mirrors Elixir's DateTime as the reference loads one (DateTime.from_iso8601/1): normalized to UTC, at microsecond resolution, remembering how many fractional digits were written (precision), so .120 stays .120 and .0 stays .0. Digits past the sixth are truncated, as the reference truncates them.

    It once loaded as a native Date, which holds milliseconds only: .123456 lost its microseconds, and .120, .12 and .1200 all read back as the same .120. toDate() still gives that Date to a caller who wants one.

    The fields are the UTC calendar fields. Applying an offset can carry the instant out of the four-digit years a literal can be written with (0000-01-01T00:00:00+00:01 is in year -1), so year is any integer here, unlike LocalDateTime's.

    Index
    • Parameters

      • year: number

        UTC

      • month: number

        UTC, 1-based

      • day: number

        UTC

      • hour: number

        UTC

      • minute: number

        UTC

      • second: number
      • Optionalmicrosecond: number = 0
      • Optionalprecision: number = ...

        fractional digits to display, 0..6

      Returns DateTime

    day: number
    hour: number
    microsecond: number
    minute: number
    month: number
    precision: number
    second: number
    year: number
    • The reference's equality, which -key = [...] removes by: the same instant written to the same precision. 07:32:00Z and 08:32:00+01:00 are equal; 07:32:00Z and 07:32:00.0Z are not.

      Parameters

      • other: unknown

      Returns boolean

    • Returns string

      YYYY-MM-DDTHH:MM:SS[.fraction]Z, Elixir's DateTime.to_iso8601/1 of a UTC datetime

    • The same instant, with the millisecond as its fraction (three digits), or none when the millisecond is zero.

      Parameters

      • date: Date

      Returns DateTime

    • Parses an RFC 3339 datetime with a Z or ±HH:MM offset and normalizes it to UTC.

      Parameters

      • text: string

        YYYY-MM-DDTHH:MM:SS[.fraction](Z|±HH:MM)

      Returns DateTime

      for any other shape, a missing offset included

      for an impossible date, time, or offset