[Minor] code cleanup

This commit is contained in:
Robert von Burg 2022-07-11 10:24:38 +02:00
parent 61768b5cad
commit 3f8a29c7e2
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 17 additions and 17 deletions

View File

@ -310,6 +310,23 @@
formatDate: function (string) {
return Strolch.toLocalDate(string);
},
formatDateTimePaddedWithSeconds: function (value) {
return this.formatDateTime(value, true);
},
formatDateTimePadded: function (value, withSeconds) {
var dateTime;
if (value == null || value === "" || value === "-" || value === "1970-01-01T01:00:00+01:00")
return "-";
if (typeof (value) === "string") {
dateTime = new Date(value);
} else if (value instanceof Date) {
dateTime = value;
} else {
throw "Unhandled object type " + typeof (value) + ": " + value;
}
return this.getDateString(dateTime, true) + " " + this.getTimeString(dateTime, withSeconds);
},
parsePeriodUnit: function (p) {
// P3M -> months
@ -431,23 +448,6 @@
return result;
},
formatDateTimePaddedWithSeconds: function (value) {
return this.formatDateTime(value, true);
},
formatDateTimePadded: function (value, withSeconds) {
var dateTime;
if (value == null || value === "" || value === "-" || value === "1970-01-01T01:00:00+01:00")
return "-";
if (typeof (value) === "string") {
dateTime = new Date(value);
} else if (value instanceof Date) {
dateTime = value;
} else {
throw "Unhandled object type " + typeof (value) + ": " + value;
}
return this.getDateString(dateTime, true) + " " + this.getTimeString(dateTime, withSeconds);
},
// gets the clock time as displayed in the UI
getTimeString: function (datetime, withSeconds) {
var hours = datetime.getHours().toString();