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