diff --git a/client/src/components/ArchiveDelete/RolesArchive.jsx b/client/src/components/ArchiveDelete/RolesArchive.jsx
index 4e5bef348..a0b525990 100644
--- a/client/src/components/ArchiveDelete/RolesArchive.jsx
+++ b/client/src/components/ArchiveDelete/RolesArchive.jsx
@@ -11,6 +11,7 @@ import UserContext from "../../contexts/UserContext";
import { MdMoreVert, MdOutlineSearch } from "react-icons/md";
import ContentContainerWithTables from "components/Layout/ContentContainerWithTables";
import DeleteArchivedAccountModal from "components/Modals/WarningArchivedAccountDelete";
+import { formatDate } from "../../helpers/util";
const useStyles = createUseStyles(theme => ({
main: {
@@ -287,7 +288,7 @@ const RolesArchive = ({ contentContainerRef }) => {
{account?.numberOfSubmissions || "0"}
- {new Date(account.archivedAt).toLocaleDateString()}
+ {formatDate(account.archivedAt)}
|
(s ? new Date(s) : null);
+// export const formatDate = date => {
+// return date ? new Date(date).toISOString().split("T")[0] : null;
+// };
+
+// Format a date without time in the Pacific Time Zone.
+// The input is expected to be either a Javascript Date
+// OR a string in one of the formats
+// parsable by luxon as listed here: https://moment.github.io/luxon/#/parsing
export const formatDate = date => {
- return date ? new Date(date).toISOString().split("T")[0] : null;
+ if (!date) return null;
+ const isoDate =
+ date instanceof Date ? DateTime.fromJSDate(date) : DateTime.fromISO(date);
+ const formattedDate = isoDate
+ .setZone("America/Los_Angeles")
+ .toFormat("yyyy-MM-dd");
+ return formattedDate;
};
-export const formatDatetime = datetime => {
- return datetime
- ? DateTime.fromISO(datetime)
- .setZone("America/Los_Angeles")
- .toFormat("yyyy-MM-dd hh:mm a")
- : null;
+// Format a date with time in the Pacific Time Zone
+// The input is expected to be either a Javascript Date
+// OR a string in one of the formats
+// parsable by luxon as listed here: https://moment.github.io/luxon/#/parsing
+export const formatDatetime = date => {
+ if (!date) return null;
+ const isoDate =
+ date instanceof Date ? DateTime.fromJSDate(date) : DateTime.fromISO(date);
+ const formattedDate = isoDate
+ .setZone("America/Los_Angeles")
+ .toFormat("yyyy-MM-dd hh:mm a");
+ return formattedDate;
};
export const formatId = id => {
|