Skip to content
Permalink
Browse files
Bangle.js: fix 'short' time for built-in locale
  • Loading branch information
gfwilliams committed May 6, 2020
1 parent d543731 commit c6d011c7aae62324cc20dfdf06b5cc4e2c320dae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
@@ -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)
@@ -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;

Some generated files are not rendered by default. Learn more.

0 comments on commit c6d011c

Please sign in to comment.