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.
Remarks
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.
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.Remarks
The Javascript
Date
type most closely resembles a FaunaTime
, not a FaunaDate
. However, Fauna storesTime
values with nanosecond precision, while JavascriptDate
values only have millisecond precision. This TimeStub class preserves precision by storing the original string value and should be used whenever possible to passTime
values back to Fauna. Converting to a Javascript date before sending to Fauna could result in loss of precision.See
https://docs.fauna.com/fauna/current/reference/fql_reference/types#time