diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-24 22:07:48 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-24 22:59:18 (GMT) |
commit | 3aaa6e8696569eabf1bd8e4e8397c7a68bb0f747 (patch) | |
tree | 69ba3e2736ce21e37ce633cb6ec3ac9b302b24d6 /www/js/utils.js | |
parent | 0cabcadb25720f28708cd2cd7c566a64a61c6837 (diff) |
added MVC style framework
Diffstat (limited to 'www/js/utils.js')
-rw-r--r-- | www/js/utils.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/www/js/utils.js b/www/js/utils.js index a7fef1b..86c369b 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -54,6 +54,19 @@ monthname[11] = 'Dezember'; var monthname_short = new Array('Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'); +function format_time(d) { + if(Object.prototype.toString.call(d) !== '[object Date]') { + return '-'; + } + if (d.toString() === 'Invalid Date') { + return '-'; + } + var timestr = Number(d.getHours()).pad(2); + timestr += ':' + Number(d.getMinutes()).pad(2); + timestr += ':' + Number(d.getSeconds()).pad(2); + return timestr; +} + function format_datetime(d) { if(Object.prototype.toString.call(d) !== '[object Date]') { return '-'; |