From 196940fe51c30f3a743893c46f9df6eccf6eca29 Mon Sep 17 00:00:00 2001 From: Amarnath AS Date: Sat, 9 Mar 2024 17:02:09 +0530 Subject: [PATCH] feat: admin time formatter added --- client/src/pages/AdminPages/Rights/Rights.tsx | 98 ------------------- client/src/utils/timeFormat.js | 6 ++ 2 files changed, 6 insertions(+), 98 deletions(-) delete mode 100644 client/src/pages/AdminPages/Rights/Rights.tsx create mode 100644 client/src/utils/timeFormat.js diff --git a/client/src/pages/AdminPages/Rights/Rights.tsx b/client/src/pages/AdminPages/Rights/Rights.tsx deleted file mode 100644 index 78f812f..0000000 --- a/client/src/pages/AdminPages/Rights/Rights.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import React, { useEffect, useState } from "react"; -import AddRight from "../../../components/AddRight/AddRight"; -import EditRight from "../../../components/EditRight/EditRight"; -import { getRight } from "../../../Services/rightServices"; -import { getDelete } from "../../../Services/rightServices"; - -function Rights() { - const [openModal, setOpenModal] = useState(false); - const [rightDetails, setRightDetails] = useState(); - const handleModal = () => { - setOpenModal(true); - }; - useEffect(() => { - const getRights = async () => { - const response = await getRight(); - console.log("This is the response", response); - }; - }, []); - const handleDelete = async (rightId: string) => { - const response = await getDelete(rightId); - }; - return ( - <> - - -
-
- {/* Text Components */} -
-
-

Rights Management

-
-
- -
-
- {/* Table Component */} -
- - - - - - - - - - - - - - - - - -
- No - - Name - - Date - - Edit or Delete -
- 1 - Women Council Act 30418-03-2003 - - -
-
-
-
- - ); -} -export default Rights; diff --git a/client/src/utils/timeFormat.js b/client/src/utils/timeFormat.js new file mode 100644 index 0000000..47ccf08 --- /dev/null +++ b/client/src/utils/timeFormat.js @@ -0,0 +1,6 @@ +const timeFormat = (mongoDate) => { + const date = new Date(mongoDate); + const options = { month: '2-digit', day: '2-digit', year: 'numeric' }; + return date.toLocaleDateString('en-US', options); +} +export default timeFormat; \ No newline at end of file