mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
Added year option.
This commit is contained in:
parent
38abd673f3
commit
5b45301178
4 changed files with 18 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ const filterOptions = [
|
|||
{ label: 'Today', value: '1day' },
|
||||
{ label: 'This week', value: '1week' },
|
||||
{ label: 'This month', value: '1month' },
|
||||
{ label: 'This year', value: '1year' },
|
||||
];
|
||||
|
||||
export default function DateFilter({ value, onChange }) {
|
||||
|
|
|
|||
|
|
@ -12,12 +12,15 @@ export default function PageviewsChart({ data, unit, children }) {
|
|||
(label, index, values) => {
|
||||
const d = new Date(values[index].value);
|
||||
const n = data.pageviews.length;
|
||||
|
||||
switch (unit) {
|
||||
case 'day':
|
||||
if (n >= 15) {
|
||||
return index % ~~(n / 15) === 0 ? format(d, 'MMM d') : '';
|
||||
}
|
||||
return format(d, 'EEE M/d');
|
||||
case 'month':
|
||||
return format(d, 'MMMM');
|
||||
default:
|
||||
return label;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue