Skip to content

Commit

Permalink
Bangle.js: fix 'short' time for built-in locale
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed May 6, 2020
1 parent d543731 commit c6d011c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -19,6 +19,7 @@
Graphics.drawImage: Allow 8 bit palettes to be specified
Bangle.js: Remove dumping of hardware state - saves some flash memory
microbit: Remove dumping of hardware state - saves some flash memory
Bangle.js: fix 'short' time for built-in locale

2v05 : Add Array.includes
Fix (Number.toFixed) rounding, eg (1234.505).toFixed(2)
Expand Down
5 changes: 3 additions & 2 deletions libs/js/banglejs/locale.js
Expand Up @@ -2,10 +2,11 @@ exports = { name : "en_GB", 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)
time : (d,short) => { // Date to "4:15.28 pm" or "15:42"(short)
var h = d.getHours(), m = d.getMinutes()
if (short)
return d.toString().substr(16,5);
return (" "+h).substr(-2)+":"+("0"+m).substr(-2);
else {
var h = d.getHours(), m = d.getMinutes(), r = "am";
var h = r = "am";
if (h==0) { h=12; }
else if (h>=12) {
if (h>12) h-=12;
Expand Down
4 changes: 3 additions & 1 deletion 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 c6d011c

Please sign in to comment.