update to native date funcions
parent
a92a57cd94
commit
549c24943c
|
|
@ -3,3 +3,4 @@
|
|||
0.2: Correct Screen Clear and Draw.
|
||||
0.3: Minor Fixes.
|
||||
0.4: Clear Old Time on Screen Before Draw new Time
|
||||
0.5: Update Date and Time to use Native date Funcions
|
||||
|
|
@ -76,47 +76,21 @@ let rocket_sequence = 1;
|
|||
|
||||
g.clear();
|
||||
|
||||
let DayMap = ["DOM","SEG", "TER", "QUA", "QUI", "SEX", "SAB"];
|
||||
let MonthMap = [
|
||||
"JAN",
|
||||
"FEV",
|
||||
"MAR",
|
||||
"ABR",
|
||||
"MAI",
|
||||
"JUN",
|
||||
"JUL",
|
||||
"AUG",
|
||||
"SET",
|
||||
"OUT",
|
||||
"NOV",
|
||||
"DEZ",
|
||||
];
|
||||
let GetCurrentDay = (current_day) => {
|
||||
if (current_day < 10) {
|
||||
current_day = "0" + current_day;
|
||||
}
|
||||
return current_day;
|
||||
};
|
||||
|
||||
function DrawClock() {
|
||||
let d = new Date();
|
||||
let h = d.getHours(),
|
||||
m = d.getMinutes();
|
||||
let time = h + ":" + ("0" + m).substr(-2);
|
||||
g.setFont("7x11Numeric7Seg", 3);
|
||||
|
||||
g.clearRect(80, 57, 170, 96);
|
||||
g.setColor(0, 255, 255);
|
||||
g.drawRect(80, 57, 170, 96);
|
||||
g.fillRect(80, 57, 170, 96);
|
||||
g.setColor(0, 0, 0);
|
||||
g.drawString(time, 70, 60);
|
||||
g.drawString(require("locale").time(new Date(), 1), 70, 60);
|
||||
g.setFont("8x12", 2);
|
||||
g.drawString(DayMap[d.getDay()], 18, 130);
|
||||
g.drawString(require("locale").dow(new Date(), 2).toUpperCase(), 18, 130);
|
||||
g.setFont("8x12");
|
||||
g.drawString(MonthMap[d.getMonth() - 1], 80, 126);
|
||||
g.drawString(require("locale").month(new Date(), 2).toUpperCase(), 80, 126);
|
||||
g.setFont("8x12", 2);
|
||||
g.drawString(GetCurrentDay(d.getDate()), 78, 137);
|
||||
const time = new Date().getDate();
|
||||
g.drawString(time < 10 ? "0" + time : time, 78, 137);
|
||||
}
|
||||
|
||||
function DrawBattery() {
|
||||
|
|
@ -167,7 +141,6 @@ Bangle.on("lcdPower", (on) => {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
Bangle.on("lock", (locked) => {
|
||||
if (locked) {
|
||||
ClearIntervals(true);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"description": "Animated Clock with Space Cassio Watch Style",
|
||||
"screenshots": [{ "url": "screens/main.png" }],
|
||||
"icon": "app.png",
|
||||
"version": "0.4",
|
||||
"version": "0.5",
|
||||
"type": "clock",
|
||||
"tags": "clock, weather, cassio, retro",
|
||||
"supports": ["BANGLEJS2"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue