Millwork
    Preparing search index...

    Interface DateCodecFamily<T>

    The contract that each date adapter package implements: one codec factory for each wire kind. date, datetime and epoch are required. The other kinds are optional, because not every library has them. Build each codec with defineCodec and the parsers in this module.

    interface DateCodecFamily<T extends DateTypes> {
        name: string;
        date(): Codec<string, T["date"]>;
        datetime(): Codec<
            string,
            T["instant"],
            { keepOffset?: boolean }
            | undefined,
        >;
        duration?(): Codec<
            string
            | number,
            T["duration"],
            { unit?: "s" | "ms" | "iso" } | undefined,
        >;
        epoch(): Codec<
            string
            | number,
            T["instant"],
            { unit?: EpochUnit } | undefined,
        >;
        interval?(): Codec<
            string
            | { end: string; start: string },
            T["interval"],
            IntervalOptions | undefined,
        >;
        localDateTime?(): Codec<string, T["localDateTime"]>;
        time?(): Codec<string, T["time"]>;
        yearMonth?(): Codec<string, T["yearMonth"]>;
        zonedDateTime?(): Codec<
            string
            | { at: string; zone: string },
            T["zonedDateTime"],
            ZonedOptions | undefined,
        >;
    }

    Type Parameters

    Index
    name: string

    The adapter name, such as 'temporal'.

    • RFC 3339 with an offset or Z. keepOffset writes the offset of the value, not Z.

      Returns Codec<string, T["instant"], { keepOffset?: boolean } | undefined>

    • ISO 8601, or a number in the given unit.

      Returns Codec<string | number, T["duration"], { unit?: "s" | "ms" | "iso" } | undefined>

    • RFC 9557 "...[America/Toronto]", or { at, zone }.

      Returns Codec<
          string
          | { at: string; zone: string },
          T["zonedDateTime"],
          ZonedOptions | undefined,
      >