From 85c173a4704c1239e678fec599637de7f015d330 Mon Sep 17 00:00:00 2001 From: akcodez Date: Tue, 27 Aug 2024 10:05:45 -0700 Subject: [PATCH] correct moment time display --- community/events.page.tsx | 4 ++-- community/index.page.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/community/events.page.tsx b/community/events.page.tsx index ce5178f668..d8ff9d3495 100644 --- a/community/events.page.tsx +++ b/community/events.page.tsx @@ -42,8 +42,8 @@ function categorizeDates(arr) { const upcoming = []; const today = moment().startOf("day"); // Set the time to midnight arr.forEach((obj) => { - const startDate = moment(obj.startDate); // Parse the 'startDate' string into a moment object - const endDate = moment(obj.endDate); // Parse the 'endDate' string into a moment object + const startDate = moment.utc(obj.startDate); // Parse the 'startDate' string into a moment object + const endDate = moment.utc(obj.endDate); // Parse the 'endDate' string into a moment object let clone = { ...obj }; // Determine the date format based on whether startDate and endDate are the same or in the same month if (startDate.isSame(endDate, 'day')) { diff --git a/community/index.page.tsx b/community/index.page.tsx index 74cac45cf4..25a5b07f5f 100644 --- a/community/index.page.tsx +++ b/community/index.page.tsx @@ -25,8 +25,8 @@ const findNearestUpcomingEvent = (events) => { let index; let eventsClone = []; events?.forEach((event, i) => { - const startDate = moment(event.startDate); // Use the updated key `startDate` - const endDate = moment(event.endDate); // Parse the 'endDate' string into a moment object + const startDate = moment.utc(event.startDate); // Use the updated key `startDate` + const endDate = moment.utc(event.endDate); // Parse the 'endDate' string into a moment object const currentDate = moment(); const diff = startDate.diff(currentDate, "days"); let clone = { ...event };