diff --git a/src/pages/Gallary/ImageGallary.jsx b/src/pages/Gallary/ImageGallary.jsx index 90865a9b..016d2bc6 100644 --- a/src/pages/Gallary/ImageGallary.jsx +++ b/src/pages/Gallary/ImageGallary.jsx @@ -9,6 +9,7 @@ import Avatar from "../../components/common/Avatar"; import DateRangePicker from "../../components/common/DateRangePicker"; import eventBus from "../../services/eventBus"; import Breadcrumb from "../../components/common/Breadcrumb"; +import {formatUTCToLocalTime} from "../../utils/dateUtils"; const PAGE_SIZE = 10; const SCROLL_THRESHOLD = 5; @@ -467,8 +468,9 @@ const ImageGallery = () => { const firstDoc = batch.documents[0]; const userName = `${firstDoc?.uploadedBy?.firstName || ""} ${firstDoc?.uploadedBy?.lastName || "" }`.trim(); - const date = moment(firstDoc?.uploadedAt).format("DD-MM-YYYY"); - const time = moment(firstDoc?.uploadedAt).format("hh:mm A"); + const date = formatUTCToLocalTime(firstDoc?.uploadedAt) + + const showScrollButtons = batch.documents.length > SCROLL_THRESHOLD; @@ -488,7 +490,7 @@ const ImageGallery = () => { {userName} - {date} {time} + {date} diff --git a/src/pages/Gallary/ImagePop.jsx b/src/pages/Gallary/ImagePop.jsx index ec88e6d4..86cad334 100644 --- a/src/pages/Gallary/ImagePop.jsx +++ b/src/pages/Gallary/ImagePop.jsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react"; import "./ImagePop.css"; import { useModal } from "./ModalContext"; import moment from "moment"; +import {formatUTCToLocalTime} from "../../utils/dateUtils"; const ImagePop = ({ batch, initialIndex = 0 }) => { const { closeModal } = useModal(); @@ -25,9 +26,8 @@ const ImagePop = ({ batch, initialIndex = 0 }) => { const fullName = `${image.uploadedBy?.firstName || ""} ${ image.uploadedBy?.lastName || "" }`.trim(); - const date = moment(image.uploadedAt).format("YYYY-MM-DD"); - const time = moment(image.uploadedAt).format("hh:mm A"); - + const date = formatUTCToLocalTime(image.uploadedAt); + // Location and category details from the 'batch' object (as previously corrected) const buildingName = batch.buildingName; const floorName = batch.floorName; @@ -82,7 +82,7 @@ const ImagePop = ({ batch, initialIndex = 0 }) => { 👤 Uploaded By: {fullName}

- 📅 Date: {date} {time} + 📅 Date: {date}

🏢 Location: {buildingName} > {floorName} >{" "}