Skip to content
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: 6 additions & 4 deletions src/components/EventEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ b-modal(v-if="event && event.id", :id="'edit-modal-' + event.id", ref="eventEdit
td {{ event.id }}
tr
th Start
datetime(type="datetime" v-model="start")
td
input(type="datetime-local" step="1" v-model="start")
tr
th End
datetime(type="datetime" v-model="end")
td
input(type="datetime-local" step="1" v-model="end")
tr
th Duration
td {{ friendlyduration(editedEvent.duration) }}
Expand Down Expand Up @@ -78,7 +80,7 @@ export default {
computed: {
start: {
get: function () {
return moment(this.editedEvent.timestamp).format();
return moment(this.editedEvent.timestamp).format('YYYY-MM-DDTHH:mm:ss');
},
Comment on lines 81 to 84

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 To match step="1" on the inputs (which enables the seconds field in browsers), the format string should include seconds. Without this, the getter returns a string with no seconds component and the browser will reject or silently zero the seconds field even if the user typed them.

Suggested change
start: {
get: function () {
return moment(this.editedEvent.timestamp).format();
return moment(this.editedEvent.timestamp).format('YYYY-MM-DDTHH:mm');
},
start: {
get: function () {
return moment(this.editedEvent.timestamp).format('YYYY-MM-DDTHH:mm:ss');
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0d77789 — format strings updated to YYYY-MM-DDTHH:mm:ss and step="1" added to both datetime-local inputs.

set: function (dt) {
// Duration needs to be set first since otherwise the computed for end will use the new timestamp
Expand All @@ -89,7 +91,7 @@ export default {
end: {
get: function () {
const end = moment(this.editedEvent.timestamp).add(this.editedEvent.duration, 'seconds');
return end.format();
return end.format('YYYY-MM-DDTHH:mm:ss');
},
Comment on lines 91 to 95

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Same seconds-precision fix needed for the end getter.

Suggested change
end: {
get: function () {
const end = moment(this.editedEvent.timestamp).add(this.editedEvent.duration, 'seconds');
return end.format();
return end.format('YYYY-MM-DDTHH:mm');
},
end: {
get: function () {
const end = moment(this.editedEvent.timestamp).add(this.editedEvent.duration, 'seconds');
return end.format('YYYY-MM-DDTHH:mm:ss');
},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0d77789 — format strings updated to YYYY-MM-DDTHH:mm:ss and step="1" added to both datetime-local inputs.

set: function (dt) {
this.editedEvent.duration = moment(dt).diff(this.editedEvent.timestamp, 'seconds');
Expand Down