Skip to content

Format Date ​

Formats

Loading...

Formats a date/time using the specified locale and options. Localization is handled by the browser's Intl.DateTimeFormat API — no language packs required.

  • Tag: <flint-format-date>
  • Class: FlintFormatDate

Import ​

ts
import '@getufy/flint-ui'; // auto-registers all
// or
import { FlintFormatDate } from '@getufy/flint-ui';

Usage ​

html
<flint-format-date></flint-format-date>

Properties ​

PropertyAttributeTypeDefaultDescription
datedateDate | stringnew Date()The date/time to format. Accepts a Date object or any string accepted by new Date().
weekdayweekday'narrow' | 'short' | 'long' | undefinedundefinedThe format for displaying the weekday.
eraera'narrow' | 'short' | 'long' | undefinedundefinedThe format for displaying the era.
yearyear'numeric' | '2-digit' | undefinedundefinedThe format for displaying the year.
monthmonth'numeric' | '2-digit' | 'narrow' | 'short' | 'long' | undefinedundefinedThe format for displaying the month.
dayday'numeric' | '2-digit' | undefinedundefinedThe format for displaying the day.
hourhour'numeric' | '2-digit' | undefinedundefinedThe format for displaying the hour.
minuteminute'numeric' | '2-digit' | undefinedundefinedThe format for displaying the minute.
secondsecond'numeric' | '2-digit' | undefinedundefinedThe format for displaying the second.
timeZoneNametime-zone-name'short' | 'long' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric' | undefinedundefinedThe format for displaying the time zone name.
timeZonetime-zonestring | undefinedundefinedThe time zone to express the time in (e.g. "UTC", "America/New_York").
fractionalSecondDigitsfractional-second-digits1 | 2 | 3 | undefinedundefinedNumber of fractional second digits to display (1–3).
dateStyledate-style'full' | 'long' | 'medium' | 'short' | undefinedundefinedShorthand date format style. Cannot be combined with individual date field props
timeStyletime-style'full' | 'long' | 'medium' | 'short' | undefinedundefinedShorthand time format style. Cannot be combined with individual time field props
hourFormathour-format'auto' | '12' | '24''auto'The hour format to use. 'auto' uses the browser/locale default.
langlangstring''BCP 47 language tag for formatting locale (e.g. "en", "fr", "ru"). Inherits from the document when unset.

CSS Custom Properties ​

PropertyDefault
--flint-format-date-color—
--flint-format-date-font-size—