fix(reminders): set reminder date on datepicker when editing a reminder
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Setting an actual reminder date (not a relative one) flowed only from the component to the outside when setting it. When editing it, the reminder date would not be populated, causing the datepicker date to stay at the current date.
This commit is contained in:
parent
58c7da019d
commit
b057fb2784
@ -46,7 +46,7 @@
|
||||
<DatepickerInline
|
||||
v-if="activeForm === 'absolute'"
|
||||
v-model="reminderDate"
|
||||
@update:modelValue="setReminderDate(close)"
|
||||
@update:modelValue="setReminderDateAndClose(close)"
|
||||
/>
|
||||
|
||||
<x-button
|
||||
@ -105,7 +105,7 @@ const presets = computed<TaskReminderModel[]>(() => [
|
||||
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY * 7, relativeTo: defaultRelativeTo},
|
||||
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY * 30, relativeTo: defaultRelativeTo},
|
||||
])
|
||||
const reminderDate = ref(null)
|
||||
const reminderDate = ref<Date|null>(null)
|
||||
|
||||
type availableForms = null | 'relative' | 'absolute'
|
||||
|
||||
@ -135,7 +135,17 @@ const reminderText = computed(() => {
|
||||
watch(
|
||||
() => modelValue,
|
||||
(newReminder) => {
|
||||
reminder.value = newReminder || new TaskReminderModel()
|
||||
if(newReminder) {
|
||||
reminder.value = newReminder
|
||||
|
||||
if(newReminder.relativeTo === null) {
|
||||
reminderDate.value = new Date(newReminder.reminder)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
reminder.value = new TaskReminderModel()
|
||||
},
|
||||
{immediate: true},
|
||||
)
|
||||
@ -148,7 +158,7 @@ function updateData() {
|
||||
}
|
||||
}
|
||||
|
||||
function setReminderDate(close) {
|
||||
function setReminderDateAndClose(close) {
|
||||
reminder.value.reminder = reminderDate.value === null
|
||||
? null
|
||||
: new Date(reminderDate.value)
|
||||
|
Reference in New Issue
Block a user