diff --git a/src/lib/components/automations/ScheduleTrigger.svelte b/src/lib/components/automations/ScheduleTrigger.svelte index 27da5aa620..730fcbb8f0 100644 --- a/src/lib/components/automations/ScheduleTrigger.svelte +++ b/src/lib/components/automations/ScheduleTrigger.svelte @@ -1,4 +1,5 @@ + + + + + + + diff --git a/src/lib/components/common/DatePicker.svelte b/src/lib/components/common/DatePicker.svelte new file mode 100644 index 0000000000..3164cb4776 --- /dev/null +++ b/src/lib/components/common/DatePicker.svelte @@ -0,0 +1,86 @@ + + +
+
+ {month.locale($i18n.language).format('MMMM YYYY')} +
+ + +
+
+ +
+ {#each weekdays as weekday} +
{weekday}
+ {/each} +
+ +
+ {#each days as day (day.valueOf())} + {@const iso = day.format('YYYY-MM-DD')} + {@const selected = iso === value} + {@const blocked = !!min && iso < min} + + {/each} +
+
diff --git a/src/lib/components/tasks/TaskDueDate.svelte b/src/lib/components/tasks/TaskDueDate.svelte index 6630a708b0..a0879ed37e 100644 --- a/src/lib/components/tasks/TaskDueDate.svelte +++ b/src/lib/components/tasks/TaskDueDate.svelte @@ -5,6 +5,7 @@ import Dropdown from '$lib/components/common/Dropdown.svelte'; import DropdownMenu from '$lib/components/common/DropdownMenu.svelte'; import CalendarIcon from '$lib/components/icons/Calendar.svelte'; + import DatePicker from '$lib/components/common/DatePicker.svelte'; const i18n = getContext('i18n'); @@ -17,6 +18,13 @@ export let onChange: (date: string | null) => void; const day = (offset: number) => dayjs().add(offset, 'day').format('YYYY-MM-DD'); + // Quick picks, each with the date it lands on; the week ends on Sunday, as the grid's does. + $: quick = [ + [$i18n.t('Today'), day(0)], + [$i18n.t('Tomorrow'), day(1)], + [$i18n.t('End of this week'), day((7 - dayjs().day()) % 7)], + [$i18n.t('In one week'), day(7)] + ]; const pick = (value: string | null) => { show = false; if (value !== date) onChange(value); @@ -43,20 +51,18 @@ {#if labeled || !date}{/if} {#if labeled || date}{label}{/if} - - - - + + {#each quick as [label, value]} + + {/each}
-
- pick(event.currentTarget.value || null)} - /> -
+ {#if date}
diff --git a/src/lib/components/tasks/TaskList.svelte b/src/lib/components/tasks/TaskList.svelte index 7aac89a8c4..c66b294897 100644 --- a/src/lib/components/tasks/TaskList.svelte +++ b/src/lib/components/tasks/TaskList.svelte @@ -102,7 +102,7 @@