Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not use buggy toJSDate #2637

Merged
merged 1 commit into from
Aug 5, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ export default class Task {
this._summary = this.vtodo.getFirstPropertyValue('summary') || ''
this._priority = this.vtodo.getFirstPropertyValue('priority') || 0
this._complete = this.vtodo.getFirstPropertyValue('percent-complete') || 0
const comp = this.vtodo.getFirstPropertyValue('completed')
this._completed = !!comp
this._completedDate = comp ? comp.toJSDate() : null
this._completedDate = this.vtodo.getFirstPropertyValue('completed')
this._completedDateMoment = moment(this._completedDate, 'YYYYMMDDTHHmmssZ')
this._completed = !!this._completedDate
this._status = this.vtodo.getFirstPropertyValue('status')
this._note = this.vtodo.getFirstPropertyValue('description') || ''
this._related = this.getParent()?.getFirstValue() || null
Expand Down Expand Up @@ -308,15 +307,16 @@ export default class Task {
}

setCompleted(completed) {
const now = ICAL.Time.fromJSDate(new Date(), true)
if (completed) {
const now = ICAL.Time.fromJSDate(new Date(), true)
this.vtodo.updatePropertyWithValue('completed', now)
this._completedDate = now
} else {
this.vtodo.removeProperty('completed')
this._completedDate = null
}
this.updateLastModified()
this._completed = completed
this._completedDate = completed ? now.toJSDate() : null
this._completedDateMoment = moment(this._completedDate, 'YYYYMMDDTHHmmssZ')
}

Expand Down
Loading