Skip to content

Commit

Permalink
locale: fix trailing space on date < 10
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thyttan committed Mar 21, 2024
1 parent 55fbab3 commit fbef914
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/js/banglejs/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function round(n, dp) {
}
exports = { name : "system", currencySym:"£",
translate : str=>str, // as-is
date : (d,short) => short?("0"+d.getDate()).substr(-2)+"/"+("0"+(d.getMonth()+1)).substr(-2)+"/"+d.getFullYear():d.toString().substr(4,11), // Date to "Feb 28 2020" or "28/02/2020"(short)
date : (d,short) => short?("0"+d.getDate()).substr(-2)+"/"+("0"+(d.getMonth()+1)).substr(-2)+"/"+d.getFullYear():d.toString().substr(4,11).trim(), // Date to "Feb 28 2020" or "28/02/2020"(short)
time : (d,short) => { // Date to "4:15.28 pm" or "15:42"(short)
var h = d.getHours(), m = d.getMinutes()
if ((require('Storage').readJSON('setting.json',1)||{})["12hour"])
Expand Down
4 changes: 2 additions & 2 deletions libs/js/banglejs/locale.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbef914

Please sign in to comment.