1
0
Fork 0
VaultUI/src/formatDistance.js
2021-04-29 10:22:57 +01:00

17 lines
399 B
JavaScript

import { de, enGB, fr, nl, ru, it } from 'date-fns/locale'
import { formatDistance as formatDistanceReal} from 'date-fns';
function getLocale() {
return {
"en": enGB,
"fr": fr,
"nl": nl,
"ru": ru,
"de": de,
"it": it,
}[localStorage.getItem("language") || "en"];
}
export function formatDistance(d1, d2) {
return formatDistanceReal(d1, d2, { locale: getLocale() });
}