diff options
author | Christian Pointner <equinox@helsinki.at> | 2017-01-14 01:37:01 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2017-01-14 01:37:33 (GMT) |
commit | 39e95df6f4a2677bb0023c1b787c7cef0ebaee25 (patch) | |
tree | f1fd5ec255db14a716e1b25bef7ce192accb4c03 /www/js/utils.js | |
parent | 193d1e4d2e408ef00d8ff900e2022d2a04afa1c9 (diff) |
added todo app
Diffstat (limited to 'www/js/utils.js')
-rw-r--r-- | www/js/utils.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/www/js/utils.js b/www/js/utils.js index c09628c..ad64c17 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -54,6 +54,20 @@ monthname[11] = 'Dezember'; var monthname_short = new Array('Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'); +function format_date(d) { + if(Object.prototype.toString.call(d) !== '[object Date]') { + return '-'; + } + if (d.toString() === 'Invalid Date') { + return '-'; + } + var datestr = weekday_short[d.getDay()]; + datestr += ' ' + Number(d.getDate()).pad(2); + datestr += '.' + Number(d.getMonth() + 1).pad(2); + datestr += '.' + d.getFullYear(); + return datestr; +} + function format_time(d) { if(Object.prototype.toString.call(d) !== '[object Date]') { return '-'; @@ -84,7 +98,7 @@ function format_datetime(d) { return datetimestr; } -function msToTimeString(time) { +function format_durationms(time) { if(time == '-') return time; var h = Number(Math.floor(time / 3600000)); |