mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) New date filter with a calendar view
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
This commit is contained in:
41
app/client/ui/DateRangeOptions.ts
Normal file
41
app/client/ui/DateRangeOptions.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
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}],
|
||||
}];
|
||||
Reference in New Issue
Block a user