mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
correct moment time display
This commit is contained in:
@@ -42,8 +42,8 @@ function categorizeDates(arr) {
|
|||||||
const upcoming = [];
|
const upcoming = [];
|
||||||
const today = moment().startOf("day"); // Set the time to midnight
|
const today = moment().startOf("day"); // Set the time to midnight
|
||||||
arr.forEach((obj) => {
|
arr.forEach((obj) => {
|
||||||
const startDate = moment(obj.startDate); // Parse the 'startDate' string into a moment object
|
const startDate = moment.utc(obj.startDate); // Parse the 'startDate' string into a moment object
|
||||||
const endDate = moment(obj.endDate); // Parse the 'endDate' string into a moment object
|
const endDate = moment.utc(obj.endDate); // Parse the 'endDate' string into a moment object
|
||||||
let clone = { ...obj };
|
let clone = { ...obj };
|
||||||
// Determine the date format based on whether startDate and endDate are the same or in the same month
|
// Determine the date format based on whether startDate and endDate are the same or in the same month
|
||||||
if (startDate.isSame(endDate, 'day')) {
|
if (startDate.isSame(endDate, 'day')) {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ const findNearestUpcomingEvent = (events) => {
|
|||||||
let index;
|
let index;
|
||||||
let eventsClone = [];
|
let eventsClone = [];
|
||||||
events?.forEach((event, i) => {
|
events?.forEach((event, i) => {
|
||||||
const startDate = moment(event.startDate); // Use the updated key `startDate`
|
const startDate = moment.utc(event.startDate); // Use the updated key `startDate`
|
||||||
const endDate = moment(event.endDate); // Parse the 'endDate' string into a moment object
|
const endDate = moment.utc(event.endDate); // Parse the 'endDate' string into a moment object
|
||||||
const currentDate = moment();
|
const currentDate = moment();
|
||||||
const diff = startDate.diff(currentDate, "days");
|
const diff = startDate.diff(currentDate, "days");
|
||||||
let clone = { ...event };
|
let clone = { ...event };
|
||||||
|
|||||||
Reference in New Issue
Block a user