Skip to content
Snippets Groups Projects
Commit b44c2074 authored by permcu's avatar permcu
Browse files

Remove timezone handling code since LessonEvent uses UTC

parent 1be0db49
No related branches found
No related tags found
1 merge request!310Resolve "Implement Vue substitution frontend"
Pipeline #144324 failed
......@@ -183,27 +183,17 @@ export default {
};
},
methods: {
toISODateTime(date) {
// Yes js date does not do timezone...
// -> Roll our own
const tzOffset = date.getTimezoneOffset(); // minutes
const tzSign = tzOffset < 0 ? '+' : '-';
const pad = n => `${Math.floor(Math.abs(n))}`.padStart(2, '0');
// const tzString = tzSign + pad(tzOffset / 60) + ':' + pad(tzOffset % 60);
const tzString = '';
return date.toISOString().replace('Z', tzString);
},
transformCreateData(item) {
console.log("in transformCreateData", item);
console.log("selectedEvent", this.selectedEvent);
console.log("start", this.selectedEvent.start);
console.log("startISO", this.toISODateTime(this.selectedEvent.start));
let next = {
...item,
// FIXME: Pass id directly & do not parse a string here.
amends: parseInt(this.selectedEvent.uid.split('-')[1]),
datetimeStart: this.toISODateTime(this.selectedEvent.start),
datetimeEnd: this.toISODateTime(this.selectedEvent.end),
// LessonEvent has datetime in UTC & graphql does not like the Z timezone info
datetimeStart: this.selectedEvent.start.toISOString().replace('Z', ''),
datetimeEnd: this.selectedEvent.end.toISOString().replace('Z', ''),
};
console.log("in transformCreateData", next);
return next;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment