From 8d523959c52e29795550efd1bebf9abb921edf1f Mon Sep 17 00:00:00 2001 From: Tony CABAYE Date: Thu, 6 Feb 2025 17:08:34 +0100 Subject: [PATCH] fix: code format --- assets/pages/Home.tsx | 5 +---- assets/utils/format.ts | 42 +++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/assets/pages/Home.tsx b/assets/pages/Home.tsx index 88293fe7..0ed98f2d 100644 --- a/assets/pages/Home.tsx +++ b/assets/pages/Home.tsx @@ -38,10 +38,7 @@ const Home = () => { }, [params, user]); return ( -
+
{params?.["authentication_failed"] === 1 && ( { }; export const formatDate = (date: Date): string => { - return datefnsFormat(date, "dd MMMM yyyy", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }); + return datefnsFormat(date, "dd MMMM yyyy", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }); }; export const formatDateTime = (date: Date): string => { - return ( - datefnsFormat(date, "dd MMMM yyyy, HH", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) + - "h" + - datefnsFormat(date, "mm", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) - ); + return ( + datefnsFormat(date, "dd MMMM yyyy, HH", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) + + "h" + + datefnsFormat(date, "mm", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }) + ); }; export const formatDateTimeLocal = (date: Date): string => { - return datefnsFormat(date, "yyyy-MM-dd'T'HH:mm", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }); + return datefnsFormat(date, "yyyy-MM-dd'T'HH:mm", { locale: fr, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone }); }; export const formatDateFromISO = (isoDateString: string): string => { - const m = isoDateString.match(/([\d\-T:]+)\+\d{2}:\d{2}?/); // "2023-06-02T06:01:46+00:00" - if (m) { - isoDateString = m[1]; - } - isoDateString = isoDateString.includes("Z") ? isoDateString : isoDateString + "Z"; + const m = isoDateString.match(/([\d\-T:]+)\+\d{2}:\d{2}?/); // "2023-06-02T06:01:46+00:00" + if (m) { + isoDateString = m[1]; + } + isoDateString = isoDateString.includes("Z") ? isoDateString : isoDateString + "Z"; - const d = new Date(isoDateString); + const d = new Date(isoDateString); - return formatDateTime(d); + return formatDateTime(d); }; export const formatDateWithoutTimeFromISO = (isoDateString: string): string => { - const m = isoDateString.match(/([\d\-T:]+)\+\d{2}:\d{2}?/); // "2023-06-02T06:01:46+00:00" - if (m) { - isoDateString = m[1]; - } - isoDateString = isoDateString.includes("Z") ? isoDateString : isoDateString + "Z"; + const m = isoDateString.match(/([\d\-T:]+)\+\d{2}:\d{2}?/); // "2023-06-02T06:01:46+00:00" + if (m) { + isoDateString = m[1]; + } + isoDateString = isoDateString.includes("Z") ? isoDateString : isoDateString + "Z"; - const d = new Date(isoDateString); + const d = new Date(isoDateString); - return formatDate(d); + return formatDate(d); }; export const trimObject = (obj: object): object => {