Member Junction
    Preparing search index...

    Function FormatDateOnly

    • Formats a date-only value as the calendar day it stores, in the reader's locale format.

      A date column arrives as a Date at UTC midnight. Passing that through a local-time formatter subtracts the reader's offset and lands on the previous day for everyone west of Greenwich: a stored 2026-11-20 renders as 11/19/2026 in America/New_York, and 2026-01-01 as 12/31/2025, the wrong year. Pinning the zone to UTC rather than switching to toISOString() keeps the reader's locale format (a US reader still sees 11/20/2026, a UK reader 20/11/2026) and changes only the zone the day is computed in. Any options the caller passes are honoured except the zone.

      Parameters

      • value: string | number | Date

        A Date, an epoch number, or a date string; an unparseable value is returned as-is

      • Optionaloptions: DateTimeFormatOptions

        Intl date options (month/day/year styles, dateStyle, weekday); timeZone is always UTC

      • Optionallocale: string | string[]

        Locale for the format; defaults to the runtime's locale

      Returns string