slint icon indicating copy to clipboard operation
slint copied to clipboard

Time formatting

Open xentec opened this issue 1 year ago • 3 comments

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 ints 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.

xentec avatar Oct 03 '23 14:10 xentec

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

ogoffart avatar Oct 04 '23 08:10 ogoffart

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?

tronical avatar Oct 04 '23 08:10 tronical

Related: #5122

Enyium avatar Aug 10 '24 15:08 Enyium