Skip to content

Format Date ​

Formats

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

Import ​

ts
import 'flint-ui'; // auto-registers all
// or
import { FlintFormatDate } from '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(). Defaults to the time at which the element is instantiated. The displayed value does not auto-update while the element remains in the DOM — set a new date prop to refresh it.
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 (year, month, day, weekday, era). Use timeStyle together with this for a full timestamp.
timeStyletime-style'full' | 'long' | 'medium' | 'short' | undefinedundefinedShorthand time format style. Cannot be combined with individual time field props (hour, minute, second). Use dateStyle together with this for a full timestamp.
hourFormathour-format'auto' | '12' | '24''auto'The hour format to use. 'auto' uses the browser/locale default. '12' forces 12-hour time. '24' forces 24-hour time.
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-colorinherit
--flint-format-date-font-sizeinherit