Repository navigation
Human Formatting of Temporal Values #592
Description
Activity
- addedC-enhancementNew feature or requestNew feature or requestC-apiChanges related to the public APIChanges related to the public API
on Sep 26, 2025 Hi! Thanks for taking a look at temporal_rs!
As of right now, there is not a way to serialize to a locale string.
Personally, I would very much like to have
to_locale_stringmethods supported in some way for all primary types usingicu_datetimeas the underlying implementation. This would have to be behind a feature flag, because some engines use ICU4C's datetime formatting. That being said, whiletemporal_rsultimately is meant to support ECMAScript implementations, it's also a way to use the Temporal API in Rust. Not supportingto_locale_stringwould mean that the temporal_rs's Rust API is not covering the entirety of the Temporal API.There's some caveats to this though. Ideally, the implementation of
to_locale_stringshould be ECMA402 compliant. Although, I could imagine a world where there is an intermediate method that translate to the different ICU formatters that allow more configuration than whatever "ECMA402 compliant" is, but we'll have to see.There has been some progress on ECMA402's
Intl.DateTimeFormatthat began in Boa with boa-dev/boa#4378. As that progresses further, some API will hopefully be made available ontemporal_rsto support this in Rust.Also, thanks for the issues / feedback! If you have questions on anything else, feel free to submit issues 😄
Marking as blocked as handling human formatting time values would be blocked on an ecma402 crate being available
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
I was interested in investigating this crate as a potential replacement for my usage of
chronoandchrono_tz, but noted that it doesn't have any facility for formatting a date in a human-readable form. I presume that the idea would be to use theicu_datetimeandicu_localecrates as the basis for doing that, but is there a recommended "ramp" for converting Temporal values into the appropriate ICU types?Could Temporal provide appropriate functions (perhaps gated behind a feature flag) that either allowed conversion to those ICU types or access to the ICU formatters?