import * as locales from 'date-fns/locale';
export const getLibraryCardAssetDate = (date: string) => {
const userLocale =
navigator.languages && navigator.languages.length
? navigator.languages[0]
: navigator.language;
return format(
parse(date, 'yyyy-MM-dd HH:mm:ss', new Date()),
'MMM dd, yyyy',
{ locale: locales[userLocale] }
);
};
export const getDate = (date) => {
const userLocale =
navigator.languages && navigator.languages.length
? navigator.languages[0]
: navigator.language;
return format(
parse(date, 'yyyy-MM-dd HH:mm:ss', new Date()),
'MMM dd, yyyy',
{ locale: userLocale }
);
};