From a2dd02abdb367c6a9f635012131a4e9486673f07 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Tue, 2 Jan 2024 14:27:18 +0530 Subject: [PATCH] chore: update `renderFormattedTime` function params. --- web/components/notifications/notification-card.tsx | 2 +- web/helpers/date-time.helper.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/components/notifications/notification-card.tsx b/web/components/notifications/notification-card.tsx index cc3303445..bf0ae81bf 100644 --- a/web/components/notifications/notification-card.tsx +++ b/web/components/notifications/notification-card.tsx @@ -149,7 +149,7 @@ export const NotificationCard: React.FC = (props) => {

- Till {renderFormattedDate(notification.snoozed_till)}, {renderFormattedTime(notification.snoozed_till, '12hour')} + Till {renderFormattedDate(notification.snoozed_till)}, {renderFormattedTime(notification.snoozed_till, '12-hour')}

) : ( diff --git a/web/helpers/date-time.helper.ts b/web/helpers/date-time.helper.ts index 1a4e528a7..bc5daa2a3 100644 --- a/web/helpers/date-time.helper.ts +++ b/web/helpers/date-time.helper.ts @@ -59,16 +59,16 @@ export const renderFormattedPayloadDate = (date: Date | string): string | null = * @param {string | Date} date * @param {boolean} timeFormat (optional) // default 24 hour * @example renderFormattedTime("2024-01-01 13:00:00") // 13:00 - * @example renderFormattedTime("2024-01-01 13:00:00", "12hour") // 01:00 PM + * @example renderFormattedTime("2024-01-01 13:00:00", "12-hour") // 01:00 PM */ -export const renderFormattedTime = (date: string | Date, timeFormat: "12hour" | "24hour" = "24hour"): string => { +export const renderFormattedTime = (date: string | Date, timeFormat: "12-hour" | "24-hour" = "24-hour"): string => { if (!date || date === "") return ""; // Parse the date to check if it is valid const parsedDate = new Date(date); // Check if the parsed date is valid if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates // Format the date in 12 hour format if in12HourFormat is true - if (timeFormat === "12hour") { + if (timeFormat === "12-hour") { const formattedTime = format(parsedDate, "hh:mm a"); return formattedTime; }