Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/card/DueDateSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,19 @@
stringify: this.stringify,
parse: this.parse,
},
// Set while waiting for the due date to be persisted so the picker can be opened once it appears
openPickerOnceSet: false,
}
},
watch: {
duedate(newVal) {
if (newVal && this.openPickerOnceSet) {
this.openPickerOnceSet = false
this.$nextTick(() => this.openDatePicker())
}
},
},
computed: {

Check warning on line 169 in src/components/card/DueDateSelector.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The "computed" property should be above the "watch" property on line 161
duedate: {
get() {
return this.card?.duedate ? new Date(this.card.duedate) : null
Expand Down Expand Up @@ -221,9 +231,20 @@
now.setHours(8)
now.setMinutes(0)
now.setMilliseconds(0)
// The picker is only rendered once the due date has been persisted and passed back down via props
this.openPickerOnceSet = true
this.duedate = now
}
},
openDatePicker() {
const input = document.getElementById('card-duedate-picker')
// showPicker is not supported by all browsers, fall back to focusing the input
if (input?.showPicker) {
input.showPicker()
} else {
input?.focus()
}
},
removeDue() {
this.duedate = null

Expand Down
Loading