Skip to main content

Format Date

<gstock-format-date> | GstockFormatDate

API

Properties

Name Description Reflects Type Default
date The date/time to format. If not set, the current date and time will be used. When passing a string, it’s strongly recommended to use the ISO 8601 format to ensure timezones are handled correctly. To convert a date to this format in JavaScript, use date.toISOString(). Date | string new Date()
dateFormat
date-format
Date format to use when parsing and formatting date. Reflects DateFormat | undefined undefined
weekday The format for displaying the weekday. 'narrow' | 'short' | 'long' -
era The format for displaying the era. 'narrow' | 'short' | 'long' -
year The format for displaying the year. 'numeric' | '2-digit' -
month The format for displaying the month. 'numeric' | '2-digit' | 'narrow' | 'short' | 'long' -
day The format for displaying the day. 'numeric' | '2-digit' -
hour The format for displaying the hour. 'numeric' | '2-digit' -
minute The format for displaying the minute. 'numeric' | '2-digit' -
second The format for displaying the second. 'numeric' | '2-digit' -
timeZoneName
time-zone-name
The format for displaying the time. 'short' | 'long' -
timeZone
time-zone
The time zone to express the time in. string -
hourFormat
hour-format
The format for displaying the hour. 'auto' | '12' | '24' 'auto'
updateComplete

A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties .