Changes in date format in Attendance logs and attendance.
This commit is contained in:
parent
833a54e57a
commit
f433e55a96
@ -1,6 +1,6 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEmployeeAttendacesLog } from "../../hooks/useAttendance";
|
||||
import { convertShortTime } from "../../utils/dateUtils";
|
||||
import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { THRESH_HOLD } from "../../utils/constants";
|
||||
|
||||
@ -8,16 +8,6 @@ const AttendLogs = ({ Id }) => {
|
||||
const { logs, loading } = useEmployeeAttendacesLog(Id);
|
||||
const navigate = useNavigate();
|
||||
|
||||
// 🔹 Utility: format date as DD-MM-YYYY
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr) return "";
|
||||
const date = new Date(dateStr);
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const year = date.getFullYear();
|
||||
return `${day}-${month}-${year}`;
|
||||
};
|
||||
|
||||
const isCheckoutRegularized = (
|
||||
activityTimeStr,
|
||||
checkoutTimeStr,
|
||||
@ -138,7 +128,7 @@ const AttendLogs = ({ Id }) => {
|
||||
<p>
|
||||
Attendance logs for{" "}
|
||||
{logs[0]?.employee?.firstName + " " + logs[0]?.employee?.lastName}{" "}
|
||||
on {formatDate(logs[0]?.activityTime)}
|
||||
on {formatUTCToLocalTime(logs[0]?.activityTime)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@ -166,13 +156,13 @@ const AttendLogs = ({ Id }) => {
|
||||
.sort((a, b) => b.id - a.id)
|
||||
.map((log, index) => (
|
||||
<tr key={index}>
|
||||
<td>{formatDate(log.activityTime)}</td>
|
||||
<td>{formatUTCToLocalTime(log.activityTime)}</td>
|
||||
<td>{convertShortTime(log.activityTime)}</td>
|
||||
<td>
|
||||
{whichActivityPerform(log.activity, log.activityTime)}
|
||||
</td>
|
||||
<td>
|
||||
{log?.latitude !== 0 ? (
|
||||
{log?.latitude != 0 ? (
|
||||
<i
|
||||
className="bx bx-map text-danger cursor-pointer"
|
||||
data-bs-toggle="tooltip"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect, useCallback, useMemo } from "react";
|
||||
import moment from "moment";
|
||||
import Avatar from "../common/Avatar";
|
||||
import { convertShortTime } from "../../utils/dateUtils";
|
||||
import { convertShortTime, formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||
import RenderAttendanceStatus from "./RenderAttendanceStatus";
|
||||
import usePagination from "../../hooks/usePagination";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
@ -116,7 +116,7 @@ const Attendance = ({ getRole, handleModalData, searchTerm }) => {
|
||||
<>
|
||||
<div className="table-responsive text-nowrap h-100" >
|
||||
<div className="d-flex text-start align-items-center py-2">
|
||||
<strong>Date : {todayDate.toLocaleDateString("en-GB")}</strong>
|
||||
<strong>Date : {formatUTCToLocalTime(todayDate)}</strong>
|
||||
<div className="form-check form-switch text-start m-0 ms-5">
|
||||
<input
|
||||
type="checkbox"
|
||||
|
Loading…
x
Reference in New Issue
Block a user