Skip to content

How to get the shortened names of Weekdays and months #4631

Answered by sffc
HolgerGottChristensen asked this question in Q&A
Discussion options

You must be logged in to vote

You can access this information using one of two experimental APIs:

  1. https://unicode-org.github.io/icu4x/rustdoc/icu_datetime/options/components/index.html -- request component weekday with Text::Short
  2. https://unicode-org.github.io/icu4x/rustdoc/icu_datetime/neo_pattern/struct.DateTimePattern.html -- create a pattern for a standalone weekday or month name field, which you can find in the DateTime field table, such as LLLL and ccc

Note that option 1 is released on crates.io but option 2 is newer code. When we have semantic skeleta (#1317) that will be another option to access this data.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HolgerGottChristensen
Comment options

Answer selected by HolgerGottChristensen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants