diff options
Diffstat (limited to 'www/js/utils.js')
-rw-r--r-- | www/js/utils.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/www/js/utils.js b/www/js/utils.js index ad64c17..ae2ad0a 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -54,6 +54,16 @@ monthname[11] = 'Dezember'; var monthname_short = new Array('Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'); +function format_date_iso(d) { + if(Object.prototype.toString.call(d) !== '[object Date]') { + return '-'; + } + if (d.toString() === 'Invalid Date') { + return '-'; + } + return d.getFullYear() + '-' + Number(d.getMonth() + 1).pad(2) + '-' + Number(d.getDate()).pad(2); +} + function format_date(d) { if(Object.prototype.toString.call(d) !== '[object Date]') { return '-'; |