Skip to content

Commit

Permalink
Fix #65: setting a custom date for a new entry
Browse files Browse the repository at this point in the history
  • Loading branch information
agateblue committed Oct 8, 2023
1 parent 7eab17b commit 8da9aa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/EntryForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ export default {
await this.$store.dispatch('triggerWebhook', {payload: webhookPayload})
},
async addNew () {
let date = this.date ? new Date(this.date) : new Date()
let now = new Date ()
let date = this.date ? new Date(this.date) : now
let data = {
...getNewEntryData(this.text, {thread: this.thread}),
date: date.toISOString(),
form: this.currentFormId,
}
data.data = getFormData(data, this.formData)
data._id = data.date
data._id = now
let e = await this.$store.dispatch('addEntry', data)
this.$emit('created', e)
this.text = ''
Expand Down
1 change: 1 addition & 0 deletions src/views/Diary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default {
Object.assign(e, entry)
}
})
await this.search()
trackEvent(this.$store, "entry.updated")
},
async search () {
Expand Down

0 comments on commit 8da9aa0

Please sign in to comment.