From b9cd8c426db8e3edbcf8fe5736c1bc86b6b626a1 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Thu, 21 Nov 2024 15:38:13 -0500 Subject: [PATCH] fix(api): append time to formatted date when a custom date format is selected --- .../resolvers/notifications/notifications.service.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts b/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts index 686ebd748..f4d0d981a 100644 --- a/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts +++ b/api/src/unraid-api/graph/resolvers/notifications/notifications.service.ts @@ -721,7 +721,14 @@ export class NotificationsService { return timestamp; } this.logger.debug(`[formatTimestamp] ${settings.date} :: ${settings.time} :: ${date}`); - return strftime(settings.date, date); + + let formatted = strftime(settings.date, date); + // %c represents System Time (i.e. the system's default date-time format). + // This seems to include time, so we shouldn't append time if %c is the format setting. + if (settings.date !== '%c') { + formatted += " " + strftime(settings.time ?? "%I:%M %p", date); + } + return formatted; } /**------------------------------------------------------------------------