quickbase-js - v3.2.1
    Preparing search index...

    Class QuickbaseDate

    A Date field's value: a calendar day, held as local midnight.

    Read it with local methods (getDate(), toLocaleDateString()), which give the stored day in any time zone, in a browser or on a server. It serializes as the day ("2024-01-15"), and so does String(date), so JSON.stringify and template strings carry the day rather than a moment: sent from a server to a browser in another time zone, or upserted back, it stays the same day.

    toLocaleDateString() and toLocaleString() show the day whatever timeZone option they are given: a day has no time zone, and formatting local midnight in another zone would show the day before or after. A separate Intl.DateTimeFormat(...).format(date) doesn't go through them and does shift the day; pass { timeZone: 'UTC' } and date.toUTCDay() to it.

    toISOString() is still a moment (local midnight in UTC), and its date part is the day before east of UTC. Use QuickbaseDate.toISODate instead.

    structuredClone and postMessage copy it as a plain Date; make it a QuickbaseDate again with QuickbaseDate.from before upserting it.

    Hierarchy

    • Date
      • QuickbaseDate
    Index

    Constructors

    • Parameters

      • year: number

        Full year (2024)

      • month: number

        Month, 1-12 (unlike Date's 0-11)

      • day: number

        Day of the month, 1-31

      Returns QuickbaseDate

      RangeError for a day that doesn't exist (2024-02-30), which a Date would quietly roll over (to March 1)

    Accessors

    • get kind(): "date"

      Which kind of QuickBase date this is (on the prototype, so not an own key)

      Returns "date"

    Methods

    • The day as QuickBase reads and writes it: "2024-01-15".

      Returns string

    • Serializes as the day, the only form a Date field accepts.

      Returns string

    • The day in the given locale, whatever timeZone the options name.

      Parameters

      • Optionallocales: LocalesArgument
      • Optionaloptions: DateTimeFormatOptions

      Returns string

    • The day (at midnight) in the given locale, whatever timeZone the options name.

      Parameters

      • Optionallocales: LocalesArgument
      • Optionaloptions: DateTimeFormatOptions

      Returns string

    • The day, "2024-01-15", so a template string or query filter gets the day.

      Returns string

    • The same day at UTC midnight, for formatting with timeZone: 'UTC'.

      Returns Date