This commit is contained in:
2024-10-23 13:19:46 +05:30
parent 1db53eaffd
commit 86ed2fcbd4
3 changed files with 19 additions and 3 deletions

View File

@@ -28,3 +28,19 @@ export function formatRelativeDate(dateString) {
export const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timeZone); // e.g., "America/New_York"
export function formatUTCToDDMMYYHHMMSS(utcDateString) {
const date = new Date(utcDateString);
// Extract individual date and time components
const day = String(date.getUTCDate()).padStart(2, '0');
const month = String(date.getUTCMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = String(date.getUTCFullYear()).slice(-2); // Get last two digits of the year
const hours = String(date.getUTCHours()).padStart(2, '0');
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
// Combine the formatted parts
return `${day}-${month}-${year} ${hours}:${minutes}:${seconds}`;
}

View File

@@ -18,7 +18,7 @@ import Pagination from "../Pagination";
import GlobalStateContext from "../../Contexts/GlobalStateContext";
import { Link, useLocation, useNavigate } from "react-router-dom";
import ToastBox from "../ToastBox";
import { formatRelativeDate } from "../../Constants/Constants";
import { formatRelativeDate, formatUTCToDDMMYYHHMMSS } from "../../Constants/Constants";
import {
useGetTransAllQuery,
useGetTransCountQuery,
@@ -377,7 +377,7 @@ const LatestTransactions = () => {
Date and Time Stamp :
</Text>
<Text color={colorMode === "light" ? "#230A79" : "#B09AFF"}>
{timestamp}
{formatUTCToDDMMYYHHMMSS(timestamp)}
</Text>
</Box>
<Box>