summaryrefslogtreecommitdiff
path: root/www/js/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/utils.js')
-rw-r--r--www/js/utils.js16
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));