time utils

This commit is contained in:
Mylloon 2022-07-26 23:54:11 +02:00
parent 5e17b7e351
commit 1349ad52bb
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

16
src/utils/time.ts Normal file
View file

@ -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<string, unknown>,
date: Date
) => {
return date.toLocaleString(lang).replace(' ', ` ${
locale.get('u_time_at')
} `);
};