I have a 1180 ms duration and when I give a toStr it gives me obviously "1180ms". But I want to get "1second 180 ms" and if I have 61000 ms I want to display "1 min 1 second"
Is is possible to have it without not defining ad-hoc function?
Thanks, Xan.
andyWed 6 Jun 2012
Try toLocale
XanSat 9 Jun 2012
It does not works. It returns "1180 ms" result too.
Xan.
StephenVilesSun 10 Jun 2012
You could try porting one of the following from Ruby to Fantom:
I really think Duration.toLocale will do what you want and it does proper localization. You have one specific example where it doesn't do exactly what you want, but that is because anything under 2sec is displayed in milliseconds. After that it starts rounding to the second. You should try it out with other values:
Xan Wed 6 Jun 2012
Hi,
I have a 1180 ms duration and when I give a toStr it gives me obviously "1180ms". But I want to get "1second 180 ms" and if I have 61000 ms I want to display "1 min 1 second"
Is is possible to have it without not defining ad-hoc function?
Thanks, Xan.
andy Wed 6 Jun 2012
Try
toLocale
Xan Sat 9 Jun 2012
It does not works. It returns "1180 ms" result too.
Xan.
StephenViles Sun 10 Jun 2012
You could try porting one of the following from Ruby to Fantom:
You'll need to add code to handle milliseconds.
brian Mon 11 Jun 2012
I really think Duration.toLocale will do what you want and it does proper localization. You have one specific example where it doesn't do exactly what you want, but that is because anything under 2sec is displayed in milliseconds. After that it starts rounding to the second. You should try it out with other values:
Xan Mon 11 Jun 2012
Why under 2 sec this has this behaviour? Is it not logic?
Xan.