replace deprecated JS substr()

This commit is contained in:
Proddy
2023-02-26 13:44:51 +01:00
parent 76db7b3d21
commit f179030d6c

View File

@@ -9,9 +9,9 @@ const LOCALE_FORMAT = new Intl.DateTimeFormat([...window.navigator.languages], {
});
export const formatDateTime = (dateTime: string) => {
return LOCALE_FORMAT.format(new Date(dateTime.substr(0, 19)));
return LOCALE_FORMAT.format(new Date(dateTime.substring(0, 19)));
};
export const formatLocalDateTime = (date: Date) => {
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, -1).substr(0, 19);
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, -1).substring(0, 19);
};