icu-datetime¶
Info
This documentation is for version v0.2.0 of the package. If you want to see the latest version, go to nerixyz.github.io/icu-typ.
This library is a wrapper around ICU4X' datetime
formatting for Typst which provides internationalized formatting for dates, times, and timezones.
If you're looking for documentation of an older version, append that version to the URL:
- v0.2.0: nerixyz.github.io/icu-typ/v0.2.0
- v0.1.2: nerixyz.github.io/icu-typ/v0.1.2
Usage¶
For detailed documentation, see fmt
- Format Date and Time.
Date¶
Time¶
Date and Time¶
#let dt = datetime(
year: 2024,
month: 5,
day: 31,
hour: 18,
minute: 2,
second: 23,
)
#icu.fmt(dt, locale: "ru", length: "long") \
#icu.fmt(dt, locale: "en-US", length: "long") \
#icu.fmt(dt, locale: "zh-Hans-CN", length: "long") \
#icu.fmt(dt, locale: "ar", length: "long") \
#icu.fmt(dt, locale: "fi", length: "long")
Zones¶
Zoned Datetimes¶
#let dt = datetime(
year: 2024,
month: 5,
day: 31,
hour: 18,
minute: 2,
second: 23,
)
#let tz = (
offset: "-07",
iana: "America/Los_Angeles",
)
#let opts = (
zone: tz,
date-fields: "YMDE",
time-precision: "second",
length: "long"
)
#icu.fmt(dt, ..opts, zone-style: "generic-short") \
#icu.fmt(dt, ..opts,
zone-style: "localized-offset-short",
locale: "lv"
) \
#icu.fmt(dt, ..opts,
zone-style: "exemplar-city",
locale: "en-CA-u-hc-h24-ca-buddhist"
)