mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
620e86a9f1
Summary: Implements the new date filtering panel. Design results from long discussion between: Alex, Anais, Cyprien and Dmitry. Test environment: https://grist-new-date-range-filter.fly.dev/ Test Plan: Include various new tests. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3720
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { CURRENT_DATE, IRelativeDateSpec } from "app/common/RelativeDates";
|
|
|
|
export interface IDateRangeOption {
|
|
label: string;
|
|
min: IRelativeDateSpec;
|
|
max: IRelativeDateSpec;
|
|
}
|
|
|
|
export const DateRangeOptions: IDateRangeOption[] = [{
|
|
label: 'Today',
|
|
min: CURRENT_DATE,
|
|
max: CURRENT_DATE,
|
|
}, {
|
|
label: 'Last 7 days',
|
|
min: [{quantity: -7, unit: 'day'}],
|
|
max: [{quantity: -1, unit: 'day'}],
|
|
}, {
|
|
label: 'Next 7 days',
|
|
min: [{quantity: 1, unit: 'day'}],
|
|
max: [{quantity: 7, unit: 'day'}],
|
|
}, {
|
|
label: 'Last Week',
|
|
min: [{quantity: -1, unit: 'week'}],
|
|
max: [{quantity: -1, unit: 'week', endOf: true}],
|
|
}, {
|
|
label: 'Last 30 days',
|
|
min: [{quantity: -30, unit: 'day'}],
|
|
max: [{quantity: -1, unit: 'day'}],
|
|
}, {
|
|
label: 'This week',
|
|
min: [{quantity: 0, unit: 'week'}],
|
|
max: [{quantity: 0, unit: 'week', endOf: true}],
|
|
}, {
|
|
label: 'This month',
|
|
min: [{quantity: 0, unit: 'month'}],
|
|
max: [{quantity: 0, unit: 'month', endOf: true}],
|
|
}, {
|
|
label: 'This year',
|
|
min: [{quantity: 0, unit: 'year'}],
|
|
max: [{quantity: 0, unit: 'year', endOf: true}],
|
|
}];
|