A wrapper aroud the Fauna Date type. It represents a calendar date that is not associated with a particular time or time zone, e.g. August 24th, 2006. Convert to and from Javascript Date's with the DateStub.fromDate and DateStub.toDate methods. Javascript Dates are rendered in UTC time before the date part is used. 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 always has a time associated with it, but Fauna's Date type does not. When converting from a Fauna Date to a Javascript Date, we set time to 00:00:00 UTC. When converting a Javascript Date or time string to Fauna Date, we convert to UTC first. Care should be taken to specify the desired date, since Javascript Dates use local timezone info by default.

https://docs.fauna.com/fauna/current/reference/fql_reference/types#date

Properties

dateString: 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 DateStub

  • Creates a new DateStub from a date string

    Parameters

    • dateString: string

      A plain date string. The time is converted to UTC before saving the date.

    Returns DateStub

    A new DateStub

    TypeError if a string is not provided, or RangeError if dateString is not a valid date