diff --git a/src/components/date/datepickerWithRange.vue b/src/components/date/datepickerWithRange.vue index d81d02c54..587b8409a 100644 --- a/src/components/date/datepickerWithRange.vue +++ b/src/components/date/datepickerWithRange.vue @@ -47,6 +47,122 @@ :config="flatPickerConfig" v-model="flatpickrRange" /> + +

+ {{ $t('input.datepickerRange.math.canuse') }} + {{ $t('input.datepickerRange.math.learnhow') }}. +

+ + + +

+ {{ $t('input.datepickerRange.math.intro') }} +

+

+ + now + || + +

+

+ + + Grafana + + + Elasticsearch + + +

+

{{ $t('misc.forExample') }}

+ +

{{ $t('input.datepickerRange.math.supportedUnits') }}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
s{{ $t('input.datepickerRange.math.units.seconds') }}
m{{ $t('input.datepickerRange.math.units.minutes') }}
h{{ $t('input.datepickerRange.math.units.hours') }}
H{{ $t('input.datepickerRange.math.units.hours') }}
d{{ $t('input.datepickerRange.math.units.days') }}
w{{ $t('input.datepickerRange.math.units.weeks') }}
M{{ $t('input.datepickerRange.math.units.months') }}
y{{ $t('input.datepickerRange.math.units.years') }}
+ +

{{ $t('input.datepickerRange.math.someExamples') }}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
now{{ $t('input.datepickerRange.math.examples.now') }}
now+24h{{ $t('input.datepickerRange.math.examples.in24h') }}
now/d{{ $t('input.datepickerRange.math.examples.today') }}
now/w{{ $t('input.datepickerRange.math.examples.beginningOfThisWeek') }}
now/w+1w{{ $t('input.datepickerRange.math.examples.endOfThisWeek') }}
now+30d{{ $t('input.datepickerRange.math.examples.in30Days') }}
{{ exampleDate }}||+1M/d + + {{ exampleDate }} + +
+
+
@@ -60,6 +176,7 @@ import 'flatpickr/dist/flatpickr.css' import {computed, ref, watch} from 'vue' import {useI18n} from 'vue-i18n' import {store} from '@/store' +import {format} from 'date-fns' import Popup from '@/components/misc/popup.vue' import {dateRanges} from '@/components/date/dateRanges' @@ -82,6 +199,9 @@ const flatPickerConfig = computed(() => ({ }, })) +const showHowItWorks = ref(false) +const exampleDate = format(new Date(), 'yyyy-MM-dd') + const flatpickrRange = ref('') const from = ref('') @@ -224,4 +344,12 @@ const customRangeActive = computed(() => { } } } + +.how-it-works-modal{ + font-size: 1rem; + + p { + display: inline-block !important; + } +} diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue index d218b8017..ef5eceeb9 100644 --- a/src/components/modal/modal.vue +++ b/src/components/modal/modal.vue @@ -192,13 +192,10 @@ export default { display: flex; justify-content: space-between; align-items: center; - } } } - - /* Transitions */ .modal-enter, diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index b0c639ad9..e0dccc97c 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -519,7 +519,38 @@ }, "datepickerRange": { "to": "To", - "from": "From" + "from": "From", + "math": { + "canuse": "You can use date math to filter for relative dates.", + "learnhow": "Check out how it works", + "title": "Date Math", + "intro": "Date Math allows you to specifiy relative dates which are resolved on the fly by Vikunja when applying the filter.", + "expression": "Each Date Math expression starts with an anchor date, which can either be {0}, or a date string ending with {1}. This anchor date can optionally be followed by one or more maths expressions.", + "similar": "These expressions are similar to the ones provided by {0} and {1}.", + "add1Day": "Add one day", + "minus1Day": "Subtract one day", + "roundDay": "Round down to the nearest day", + "supportedUnits": "Supported time units are:", + "someExamples": "Some examples of time expressions:", + "units": { + "seconds": "Seconds", + "minutes": "Minutes", + "hours": "Hours", + "days": "Days", + "weeks": "Weeks", + "months": "Months", + "years": "Years" + }, + "examples": { + "now": "Right now", + "in24h": "In 24h", + "today": "Today at 00:00", + "beginningOfThisWeek": "The beginning of this week at 00:00", + "endOfThisWeek": "The end of this week", + "in30Days": "In 30 days", + "datePlusMonth": "{0} plus one month at 00:00 of that day" + } + } } }, "task": {