From 0ae8a0e6ef8103731ead828e2e487e01d6a529f1 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 9 Jan 2022 16:46:12 +0100 Subject: [PATCH] feat: add more pre-defined ranges --- src/components/date/dateRanges.ts | 27 +++++++++++++++------ src/components/date/datepickerWithRange.vue | 9 ++++--- src/i18n/lang/en.json | 25 +++++++++++++------ src/views/tasks/ShowTasks.vue | 2 +- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/components/date/dateRanges.ts b/src/components/date/dateRanges.ts index c33d0426..40570be0 100644 --- a/src/components/date/dateRanges.ts +++ b/src/components/date/dateRanges.ts @@ -1,10 +1,21 @@ -// TODO: more ranges! export const dateRanges = { - 'task.show.today': ['now/d', 'now/d+1d'], - 'task.show.thisWeek': ['now/w', 'now/w+1w'], - 'task.show.nextWeek': ['now/w+1w', 'now/w+2w'], - 'task.show.next7Days': ['now', 'now+7d'], - 'task.show.thisMonth': ['now/M', 'now/M+1M'], - 'task.show.nextMonth': ['now/M+1M', 'now/M+2M'], - 'task.show.next30Days': ['now', 'now+30d'], + // Format: + // Key is the title, as a translation string, the first entry of the value array + // is the "from" date, the second one is the "to" date. + 'today': ['now/d', 'now/d+1d'], + + 'lastWeek': ['now/w-1w', 'now/w-2w'], + 'thisWeek': ['now/w', 'now/w+1w'], + 'restOfThisWeek': ['now', 'now/w+1w'], + 'nextWeek': ['now/w+1w', 'now/w+2w'], + 'next7Days': ['now', 'now+7d'], + + 'lastMonth': ['now/M-1M', 'now/M-2M'], + 'thisMonth': ['now/M', 'now/M+1M'], + 'restOfThisMonth': ['now', 'now/M+1M'], + 'nextMonth': ['now/M+1M', 'now/M+2M'], + 'next30Days': ['now', 'now+30d'], + + 'thisYear': ['now/y', 'now/y+1y'], + 'restOfThisYear': ['now', 'now/y+1y'], } diff --git a/src/components/date/datepickerWithRange.vue b/src/components/date/datepickerWithRange.vue index e2bb15b5..67aac325 100644 --- a/src/components/date/datepickerWithRange.vue +++ b/src/components/date/datepickerWithRange.vue @@ -11,15 +11,15 @@