A wrapper around the Fauna Time type. It, represents a fixed point in time without regard to calendar or location, e.g. July 20, 1969, at 20:17 UTC. Convert to and from Javascript Date's with the TimeStub.fromDate and TimeStub.toDate methods. See remarks for possible precision loss when doing this. If precision loss is a concern consider using a 3rd party datetime library such as luxon.

The Javascript Date type most closely resembles a Fauna Time, not a Fauna Date. However, Fauna stores Time values with nanosecond precision, while Javascript Date values only have millisecond precision. This TimeStub class preserves precision by storing the original string value and should be used whenever possible to pass Time values back to Fauna. Converting to a Javascript date before sending to Fauna could result in loss of precision.

Properties

isoString: string

Methods

  • Get a copy of the TimeStub converted to a Javascript Date. Does not mutate the existing TimeStub value.

    Returns Date

    A Date

  • Override default string conversion

    Returns string

    the string representation of a TimeStub