add locales to Date display

master
Nik Martin 2020-03-30 12:09:46 -05:00
parent 655488dc35
commit 7070536dff
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,8 @@
let g;
let Bangle;
// http://forum.espruino.com/conversations/345155/#comment15172813
const locale = require('locale');
const p = Math.PI / 2;
const pRad = Math.PI / 180;
const faceWidth = 100; // watch face radius
@ -8,8 +10,6 @@ let timer = null;
let currentDate = new Date();
const centerPx = g.getWidth() / 2;
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat'];
const seconds = (angle) => {
const a = angle * pRad;
const x = centerPx + Math.sin(a) * faceWidth;
@ -81,7 +81,7 @@ const drawDate = () => {
g.setColor(1, 0, 0);
g.setFont('6x8', 2);
const dayString = days[currentDate.getDay()];
const dayString = locale.dow(currentDate, true);
// pad left date
const dateString = (currentDate.getDate() < 10) ? '0' : '' + currentDate.getDate().toString();
const dateDisplay = `${dayString}-${dateString}`;