mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Added All time date filter option.
This commit is contained in:
parent
5f359b3cf1
commit
a101d639d3
4 changed files with 34 additions and 14 deletions
|
|
@ -6,7 +6,7 @@ import Modal from './Modal';
|
|||
import DropDown from './DropDown';
|
||||
import DatePickerForm from 'components/forms/DatePickerForm';
|
||||
import useLocale from 'hooks/useLocale';
|
||||
import { getDateRange, dateFormat } from 'lib/date';
|
||||
import { dateFormat } from 'lib/date';
|
||||
import Calendar from 'assets/calendar-alt.svg';
|
||||
import Icon from './Icon';
|
||||
|
||||
|
|
@ -47,6 +47,11 @@ const filterOptions = [
|
|||
value: '90day',
|
||||
},
|
||||
{ label: <FormattedMessage id="label.this-year" defaultMessage="This year" />, value: '1year' },
|
||||
{
|
||||
label: <FormattedMessage id="label.all-time" defaultMessage="All time" />,
|
||||
value: 'all',
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
label: <FormattedMessage id="label.custom-range" defaultMessage="Custom range" />,
|
||||
value: 'custom',
|
||||
|
|
@ -55,7 +60,6 @@ const filterOptions = [
|
|||
];
|
||||
|
||||
function DateFilter({ value, startDate, endDate, onChange, className }) {
|
||||
const { locale } = useLocale();
|
||||
const [showPicker, setShowPicker] = useState(false);
|
||||
const displayValue =
|
||||
value === 'custom' ? (
|
||||
|
|
@ -64,12 +68,12 @@ function DateFilter({ value, startDate, endDate, onChange, className }) {
|
|||
value
|
||||
);
|
||||
|
||||
function handleChange(value) {
|
||||
async function handleChange(value) {
|
||||
if (value === 'custom') {
|
||||
setShowPicker(true);
|
||||
return;
|
||||
}
|
||||
onChange(getDateRange(value, locale));
|
||||
onChange(value);
|
||||
}
|
||||
|
||||
function handlePickerChange(value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue