slint
slint copied to clipboard
Time formatting
I often display lists with dated items and filter them in UI logic to avoid updating the whole list over and over again.
The date values themselves are simple int
s in seconds. But to display said dates I also need to format a string inside the app logic and send it to the UI. This seems redundant.
Since formatting the data should be an UI job, I'd like to request new feature: time (and date) formatting.
It could be a simple macro like: @fmt-time(time, "<strftime>")
1
or a new time
type with a Window.default-time-format
property and localization integration.
Right now, it is possible to do that using a pure callback
in a global object, and implement the time formatting in native code.
But yes, we should support local-aware time formatting somehow through @tr("...")
in the future
Alternatively, would it perhaps make sense to provide time formatting independent from @tr
and insteadas a built-in functionality that uses icu4x behind the scenes?
Related: #5122