Skip to content

Commit 43b84a2

Browse files
authored
corrected Non‑ASCII characters
Issue: Non‑ASCII characters cause garbled output and parsing errors The code mixes Unicode punctuation with ASCII. The Bangle.js firmware and Espruino minifier do not handle characters such as the EN DASH “–” and the MINUS SIGN “−”. When the code is minified, the non‑ASCII minus sign corrupts the generated file (crsclock.app.js) and results in: Uncaught SyntaxError: Got UNFINISHED REGEX expected ']' (see crsclock.js lines 612‑614 where the Unicode minus sign is used). The EN DASH also displays incorrectly on the device (rendered as â) when showing the sleep window string (lines 84‑86) and in prompts (lines 714 and 723). References Sleep window string using EN DASH Unicode minus sign in BT calibration menu Prompts using EN DASH for ranges
1 parent 8240c2a commit 43b84a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/crsclock/crsclock.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const STATS_FONT_SIZE = 16;
8383
function getSleepWindowStr() {
8484
let a = ("0"+S.sleepStart).substr(-2) + ":00";
8585
let b = ("0"+S.sleepEnd).substr(-2) + ":00";
86-
return a + "" + b;
86+
return a + "-" + b;
8787
}
8888

8989
function stability(arr, key, hours) {
@@ -610,7 +610,7 @@ function calibrateBT() {
610610
Bangle.setUI(uiOpts);
611611
});
612612
})(d);
613-
m["" + d + "h"] = (() => () => {
613+
m["-" + d + "h"] = (() => () => {
614614
S.phaseOffset -= d;
615615
saveSettings();
616616
E.showAlert("Offset now: " + (S.phaseOffset>=0? "+"+S.phaseOffset : S.phaseOffset) + "h").then(() => {
@@ -711,7 +711,7 @@ function setBioTimeReference() {
711711
E.showMenu(m);
712712

713713
function promptRefTime() {
714-
E.showPrompt("Hour (023)?").then(h => {
714+
E.showPrompt("Hour (0-23)?").then(h => {
715715
if (h===undefined || h<0 || h>23) {
716716
E.showAlert("Invalid hour").then(() => {
717717
drawClock();
@@ -720,7 +720,7 @@ function setBioTimeReference() {
720720
return;
721721
}
722722
S.bioTimeRefHour = h;
723-
E.showPrompt("Minute (059)?").then(m => {
723+
E.showPrompt("Minute (0-59)?").then(m => {
724724
if (m===undefined || m<0 || m>59) {
725725
E.showAlert("Invalid minute").then(() => {
726726
drawClock();

0 commit comments

Comments
 (0)