Feature/support localization in date fns (#1195)
* Add locale to date-fns (formatDistanceToNow) * Update changelog
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as currencies from '@dinero.js/currencies';
|
||||
import { DataSource } from '@prisma/client';
|
||||
import { getDate, getMonth, getYear, parse, subDays } from 'date-fns';
|
||||
import { de } from 'date-fns/locale';
|
||||
|
||||
import { ghostfolioScraperApiSymbolPrefix, locale } from './config';
|
||||
import { Benchmark } from './interfaces';
|
||||
@@ -56,6 +57,14 @@ export function getCssVariable(aCssVariable: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export function getDateFnsLocale(aLanguageCode: string) {
|
||||
if (aLanguageCode === 'de') {
|
||||
return de;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getDateFormatString(aLocale?: string) {
|
||||
const formatObject = new Intl.DateTimeFormat(aLocale).formatToParts(
|
||||
new Date()
|
||||
|
Reference in New Issue
Block a user