Merge pull request #4190 from Infisical/audit-log-date-selector

improvement(frontend): Revise and expand audit log date filter and page
This commit is contained in:
Scott Wilson
2025-07-21 15:58:55 -07:00
committed by GitHub
9 changed files with 422 additions and 169 deletions
+24
View File
@@ -0,0 +1,24 @@
import { format } from "date-fns";
export enum Timezone {
Local = "local",
UTC = "UTC"
}
export const formatDateTime = ({
timezone,
timestamp,
dateFormat = "MMM do yyyy, hh:mm a"
}: {
timestamp: string | Date;
timezone?: Timezone;
dateFormat?: string;
}) => {
const date = new Date(timestamp);
if (timezone === Timezone.UTC) {
const utcDate = new Date(date.getTime() + date.getTimezoneOffset() * 60000);
return `${format(utcDate, dateFormat)}`;
}
return format(date, dateFormat);
};