From 3f8a29c7e25b159bd0dbc5f4937b2c9300a45207 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 11 Jul 2022 10:24:38 +0200 Subject: [PATCH] [Minor] code cleanup --- strolch-wc-util-behavior.html | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/strolch-wc-util-behavior.html b/strolch-wc-util-behavior.html index d9f6d0e..8655640 100644 --- a/strolch-wc-util-behavior.html +++ b/strolch-wc-util-behavior.html @@ -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();