espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.76k stars 742 forks source link

locale: fix trailing space on date < 10 #2477

Closed thyttan closed 6 months ago

thyttan commented 6 months ago

The trailing whitespace would make the date string look uncentered on e.g. antonclk clock app on Bangle.js.

Possibly similar change should be made to the locale library of espruino/BangleApps - but I'm not sure.

Also not sure if other entries could benefit from a trim() as well.

I have NOT built and flashed this to try it out.

gfwilliams commented 6 months ago

Thanks! That's interesting actually. On Node.js:

d = new Date("8 Feb 2020")
d.toString().substr(4,11)
='Feb 08 2020'

so it looks like Bangle.js is perhaps doing it wrong by not padding the day number out. Either way adding trim won't break anything if this gets fixed in the future