TimeFormat

Interface of TimeFormat
🏗 Coming Soon
Inform
Note: TimeFormat must be imported from its specific location rather than the package root.

Import path: @looker/components/lib/TimeFormat

As it's name implies, TimeFormat is used to format a javascript Date object to human readable and localized text.

This is the sibling component of DateFormat, which does the same thing for times. If no Date object is provided, it will default to Now.

3:55:33 PM

Providing A Date Object

Wrap the TimeFormat component around a javascript Date object to render time in a human-readable format.

11:06:55 PM

Format

* medium is the default format

FORMATOUTPUT
Short3:55 PM
Medium *3:55:33 PM
Long3:55:33 PM GMT+0
Full3:55:33 PM GMT+00:00

TimeZone

TimeFormat, well as DateFormat assume that the provided date object is anchored in UTC time. If you need to adjust this to display correctly, you can pass the user's preferred time zone into the timeZone prop. This component will accept any string listed in the the IANA standard

8:00:00 AM EDT

I18n

TimeFormat automatically formats the rendered date to the provided language/locale code.

  • Arabic: 3:55:33 م
  • English: 3:55:33 PM
  • German: 15:55:33

All supported Locales are listed below:

NameCode
Arabicar
Germande
Englishen
Spanishes
Frenchfr
Italianit
Japaneseja
Koreanko
Dutchnl
Polishpl
Portuguesept
PortugueseBrazilpt-br
Russianru
Swedishsv
Turkishtr
Chinesezh-cn
ChineseTaiwanzh-tw