aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--view/tpl/cdav_calendar.tpl12
1 files changed, 10 insertions, 2 deletions
diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl
index 1bf54103c..88aa0789d 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -357,8 +357,16 @@ $(document).ready(function() {
$('#calendar_select').val('channel_calendar').attr('disabled', true);
$('#id_title').val(resource.summary);
- $('#id_dtstart').val(new Date(resource.dtstart).toUTCString().slice(0, -4));
- $('#id_dtend').val(new Date(resource.dtend).toUTCString().slice(0, -4));
+
+ // A hack to match with internal workings of fullcalendar.
+ // See https://fullcalendar.io/docs/timeZone#UTC-coercion
+ let start_d = new Date(resource.dtstart);
+ let start_o = start_d.getTimezoneOffset();
+ let end_d = new Date(resource.dtend);
+ let end_o = start_d.getTimezoneOffset();
+ $('#id_dtstart').val(new Date(start_d - start_o * 60000).toUTCString().slice(0, -4));
+ $('#id_dtend').val(new Date(end_d - end_o * 60000).toUTCString().slice(0, -4));
+
$('#id_categories').tagsinput('add', '{{$categories}}'),
$('#id_description').val(resource.description);
$('#id_location').val(resource.location);