From 6936a67182af97e14300c522c5b25917b93a4dc3 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 2 Nov 2024 15:48:35 +0100 Subject: [PATCH] [UI] null check on datetime* functions. --- platypush/backend/http/webapp/src/utils/DateTime.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platypush/backend/http/webapp/src/utils/DateTime.vue b/platypush/backend/http/webapp/src/utils/DateTime.vue index 05b7393076..e76a965c06 100644 --- a/platypush/backend/http/webapp/src/utils/DateTime.vue +++ b/platypush/backend/http/webapp/src/utils/DateTime.vue @@ -3,6 +3,8 @@ export default { name: "DateTime", methods: { formatDate(date, year=false) { + if (date == null) + return null if (typeof date === 'number') date = new Date(date * 1000) else if (typeof date === 'string') @@ -12,6 +14,8 @@ export default { }, formatTime(date, seconds=true) { + if (date == null) + return null if (typeof date === 'number') date = new Date(date * 1000) if (typeof date === 'string') @@ -21,6 +25,9 @@ export default { }, formatDateTime(date, year=false, seconds=true, skipTimeIfMidnight=false) { + if (date == null) + return null + const now = new Date() if (typeof date === 'number') @@ -37,6 +44,9 @@ export default { }, formatDuration(duration, seconds=true) { + if (duration == null) + return null + if (duration == null) return ''