2021-05-03 09:25:42 +01:00
|
|
|
import { de, enGB, fr, it, nl, ru } from 'date-fns/locale'
|
2021-04-24 18:42:13 +01:00
|
|
|
import { formatDistance as formatDistanceReal} from 'date-fns';
|
2021-05-07 11:07:03 +01:00
|
|
|
import { pageState } from "./globalPageState.js";
|
2021-04-24 18:42:13 +01:00
|
|
|
|
|
|
|
function getLocale() {
|
|
|
|
return {
|
|
|
|
"en": enGB,
|
|
|
|
"fr": fr,
|
|
|
|
"nl": nl,
|
|
|
|
"ru": ru,
|
|
|
|
"de": de,
|
2021-04-29 10:22:57 +01:00
|
|
|
"it": it,
|
2021-04-30 10:38:23 +01:00
|
|
|
}[pageState.language];
|
2021-04-24 18:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function formatDistance(d1, d2) {
|
|
|
|
return formatDistanceReal(d1, d2, { locale: getLocale() });
|
|
|
|
}
|