From d866b6f9b603da67fee2f200e888200e43b6e74d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 18 Jul 2015 05:52:58 +0200 Subject: weekday short cleanup diff --git a/www/js/utils.js b/www/js/utils.js index 7d20309..b8bbd76 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -45,10 +45,11 @@ weekday[4] = "Donnerstag"; weekday[5] = "Freitag"; weekday[6] = "Samstag"; +var weekday_short = new Array('So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'); + function format_datetime(d) { if(Object.prototype.toString.call(d) === "[object Date]") { - var daynames = new Array('So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'); - var datetimestr = daynames[d.getDay()]; + var datetimestr = weekday_short[d.getDay()]; datetimestr += ' ' + Number(d.getDate()).pad(2); datetimestr += '.' + Number(d.getMonth() + 1).pad(2); datetimestr += '.' + d.getFullYear(); @@ -75,7 +76,6 @@ function msToTimeString(time) { function Clock(draw_callback) { this.draw_callback = draw_callback; - this.daynames = new Array('So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'); this.last_message = { t1: 0, t2: 0, t3: 0, t4: 0, tz_offset: 3600, week: 3 }; this.clock_offset = 0; @@ -85,7 +85,7 @@ function Clock(draw_callback) { var rdtime_ms = (+new Date()) + (this.last_message.tz_offset * 1000) + this.clock_offset; var rdtime = new Date(rdtime_ms); - var date_str = this.daynames[rdtime.getUTCDay()] + ', '; + var date_str = weekday_short[rdtime.getUTCDay()] + ', '; date_str += rdtime.getUTCDate() + '.' + (rdtime.getUTCMonth() + 1) + '.' + rdtime.getUTCFullYear(); var time_str = (rdtime.getUTCHours() > 9 ? ' ' : ' 0') + rdtime.getUTCHours(); -- cgit v0.10.2