correct moment time display

This commit is contained in:
akcodez
2024-08-27 10:05:45 -07:00
parent da63775f3e
commit 85c173a470
2 changed files with 4 additions and 4 deletions

View File

@@ -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')) {

View File

@@ -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 };