Skip to content
Snippets Groups Projects
Verified Commit bce6b8f6 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix datetime handling

parent 6586e6cc
No related branches found
No related tags found
1 merge request!310Resolve "Implement Vue substitution frontend"
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<base-calendar-feed-details <base-calendar-feed-details
v-bind="$props" v-bind="$props"
:color="currentSubject ? currentSubject.colour_bg : null" :color="currentSubject ? currentSubject.colour_bg : null"
> without-location
>
<template #title> <template #title>
<div <div
:style="{ :style="{
...@@ -232,9 +233,8 @@ export default { ...@@ -232,9 +233,8 @@ export default {
return { return {
...item, ...item,
amends: this.selectedEvent.meta.id, amends: this.selectedEvent.meta.id,
// LessonEvent has datetime in UTC & graphql does not like the Z timezone info datetimeStart: this.selectedEvent.startDateTime.toISO(),
datetimeStart: this.selectedEvent.start.toISOString().replace("Z", ""), datetimeEnd: this.selectedEvent.endDateTime.toISO(),
datetimeEnd: this.selectedEvent.end.toISOString().replace("Z", ""),
}; };
}, },
transformPatchData(item) { transformPatchData(item) {
......
...@@ -73,21 +73,6 @@ class AmendLessonCreateMutation(DjangoCreateMutation): ...@@ -73,21 +73,6 @@ class AmendLessonCreateMutation(DjangoCreateMutation):
"comment", "comment",
) )
@classmethod
def handle_datetime_start(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def handle_datetime_end(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def before_save(cls, root, info, input, obj):
obj.timezone = obj.amends.timezone
return obj
class AmendLessonPatchMutation(DjangoPatchMutation): class AmendLessonPatchMutation(DjangoPatchMutation):
class Meta: class Meta:
...@@ -95,20 +80,6 @@ class AmendLessonPatchMutation(DjangoPatchMutation): ...@@ -95,20 +80,6 @@ class AmendLessonPatchMutation(DjangoPatchMutation):
permissions = ("chronos.edit_substitution_rule",) permissions = ("chronos.edit_substitution_rule",)
only_fields = ("subject", "teachers", "groups", "rooms", "cancelled", "comment") only_fields = ("subject", "teachers", "groups", "rooms", "cancelled", "comment")
@classmethod
def handle_datetime_start(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def handle_datetime_end(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def before_save(cls, root, info, input, id, obj):
obj.timezone = obj.amends.timezone
return obj
class TimetableType(graphene.Enum): class TimetableType(graphene.Enum):
......
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