summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-28 15:23:42 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-28 15:24:28 +0100
commit7446f23b3abc30d7c53f2eaa951742371c071171 (patch)
treeb76a8d2e64c7aa850c09f8e69f01e7a262ab5cd5 /sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts
parent49b155ec687cdf58fb51fe8245a2f5f4582b68f0 (diff)
UX extensions
UX Maintenance client and further changes Change-Id: I7643661d17db5fc3d3f94b58cb42ed0be558c64f Issue-ID: SDNC-583 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts')
-rw-r--r--sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts b/sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts
new file mode 100644
index 000000000..92bc2ba8b
--- /dev/null
+++ b/sdnr/wt/odlux/apps/maintenanceApp/src/utils/timeUtils.ts
@@ -0,0 +1,22 @@
+export function convertToGMTString(dateString: string): string {
+ const date = new Date(dateString);
+ const pad = (n: number) => (n < 10) ? '0' + n : n;
+
+ return date.getUTCFullYear() +
+ '-' + pad(date.getUTCMonth() + 1) +
+ '-' + pad(date.getUTCDate()) +
+ 'T' + pad(date.getUTCHours()) +
+ ':' + pad(date.getUTCMinutes()) +
+ '+00:00';
+}
+
+export function convertToLocaleString(rawDate: string| number): string {
+ const date = new Date(rawDate);
+ const pad = (n: number) => (n < 10) ? '0' + n : n;
+
+ return date.getFullYear() +
+ '-' + pad(date.getMonth() + 1) +
+ '-' + pad(date.getDate()) +
+ 'T' + pad(date.getHours()) +
+ ':' + pad(date.getMinutes());
+} \ No newline at end of file