From 1349ad52bb84cfdb598626fafe21a1c6e55972ee Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 26 Jul 2022 23:54:11 +0200 Subject: [PATCH] time utils --- src/utils/time.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/utils/time.ts diff --git a/src/utils/time.ts b/src/utils/time.ts new file mode 100644 index 0000000..0243bbc --- /dev/null +++ b/src/utils/time.ts @@ -0,0 +1,16 @@ +/** + * Parsed string adapted with TZ (locales) and format for the specified lang. + * @param lang Lang + * @param locale Locales + * @param date Date + * @returns String + */ +export const showDate = ( + lang: string, + locale: Map, + date: Date +) => { + return date.toLocaleString(lang).replace(' ', ` ${ + locale.get('u_time_at') + } `); +};