mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Localized date and time in charts
This commit is contained in:
parent
1aa213d342
commit
fa15a470fd
2 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ const formats = {
|
||||||
millisecond: 'T',
|
millisecond: 'T',
|
||||||
second: 'pp',
|
second: 'pp',
|
||||||
minute: 'p',
|
minute: 'p',
|
||||||
hour: 'h:mm aaa - PP',
|
hour: 'p - PP',
|
||||||
day: 'PPPP',
|
day: 'PPPP',
|
||||||
week: 'PPPP',
|
week: 'PPPP',
|
||||||
month: 'LLLL yyyy',
|
month: 'LLLL yyyy',
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ export function renderDateLabels(unit: string, locale: string) {
|
||||||
|
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case 'minute':
|
case 'minute':
|
||||||
return formatDate(d, 'h:mm', locale);
|
return formatDate(d, 'p', locale).split(' ')[0];
|
||||||
case 'hour':
|
case 'hour':
|
||||||
return formatDate(d, 'p', locale);
|
return formatDate(d, 'p', locale);
|
||||||
case 'day':
|
case 'day':
|
||||||
return formatDate(d, 'MMM d', locale);
|
return formatDate(d, 'PP', locale).replace(/\W*20\d{2}\W*/, ''); // Remove year
|
||||||
case 'month':
|
case 'month':
|
||||||
return formatDate(d, 'MMM', locale);
|
return formatDate(d, 'MMM', locale);
|
||||||
case 'year':
|
case 'year':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue