Localized date and time in charts

This commit is contained in:
Harry Oosterveen committed 2025-03-12 20:49:12 +01:00
1 parent 1aa213d342
commit fa15a470fd
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ const formats = {
millisecond: 'T',
second: 'pp',
minute: 'p',
hour: 'h:mm aaa - PP',
hour: 'p - PP',
day: 'PPPP',
week: 'PPPP',
month: 'LLLL yyyy',
+2 -2
View File
@@ -11,11 +11,11 @@ export function renderDateLabels(unit: string, locale: string) {
switch (unit) {
case 'minute':
return formatDate(d, 'h:mm', locale);
return formatDate(d, 'p', locale).split(' ')[0];
case 'hour':
return formatDate(d, 'p', locale);
case 'day':
return formatDate(d, 'MMM d', locale);
return formatDate(d, 'PP', locale).replace(/\W*20\d{2}\W*/, ''); // Remove year
case 'month':
return formatDate(d, 'MMM', locale);
case 'year':