Skip to content

Commit

Permalink
Bangle.js: Remove meridian from default locale.time function (to matc…
Browse files Browse the repository at this point in the history
…h 'Languages' app)

Fix espruino/EspruinoDocs#738
  • Loading branch information
gfwilliams committed Sep 30, 2024
1 parent 7a340e8 commit c776b2c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Ensure Number("1A")==NaN, previously we just parsed the digits we could (fix #2555)
First argument of operators is now dereferenced before parsing second argument (fix #2547)
Ensure x%Infinity===x (fix #2542)
Bangle.js: Remove meridian from default locale.time function (to match 'Languages' app)

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
14 changes: 2 additions & 12 deletions libs/js/banglejs/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@ function is12Hours() {
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).trim(), // Date to "Feb 28 2020" or "28/02/2020"(short)
time : (d,short) => { // Date to "4:15.28 pm" or "15:42"(short)
time : (d,short) => { // Date to "4:15.28" or "15:42"(short)
var h = d.getHours(), m = d.getMinutes()
if (is12Hours())
h = (h%12==0) ? 12 : h%12; // 12 hour
if (short)
return (" "+h).substr(-2)+":"+("0"+m).substr(-2);
else {
var r = "am";
if (h==0) { h=12; }
else if (h>=12) {
if (h>12) h-=12;
r = "pm";
}
return (" "+h).substr(-2)+":"+("0"+m).substr(-2)+"."+("0"+d.getSeconds()).substr(-2)+" "+r;
}
return (" "+h).substr(-2)+":"+("0"+m).substr(-2) + (short?"":("."+("0"+d.getSeconds()).substr(-2)));
},
dow : (d,short) => "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(",")[d.getDay()].substr(0, short ? 3 : 10), // Date to "Monday" or "Mon"(short)
month : (d,short) => "January,February,March,April,May,June,July,August,September,October,November,December".split(",")[d.getMonth()].substr(0, short ? 3 : 10), // Date to "February" or "Feb"(short)
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 c776b2c

Please sign in to comment.