aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-07-11 11:12:27 +0200
committerMario Vavti <mario@mariovavti.com>2019-07-11 11:12:27 +0200
commit407b02bde8cc8492eefc9260c8ae6becfee2211a (patch)
tree554ba14c4030696b1eca6ede11abd547daabeedd
parentda7912b8791d4dce6c7c014be86ee6ae68f1217c (diff)
downloadvolse-hubzilla-407b02bde8cc8492eefc9260c8ae6becfee2211a.tar.gz
volse-hubzilla-407b02bde8cc8492eefc9260c8ae6becfee2211a.tar.bz2
volse-hubzilla-407b02bde8cc8492eefc9260c8ae6becfee2211a.zip
calendar: revert back to UTC strings for dates due to better legibility. Strip timezone info from UTC string and always treat values as UTC.
-rw-r--r--Zotlabs/Module/Cdav.php12
-rw-r--r--Zotlabs/Module/Channel_calendar.php6
-rw-r--r--view/tpl/cdav_calendar.tpl42
3 files changed, 30 insertions, 30 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index b199019c1..e2855d2b6 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -278,11 +278,11 @@ class Cdav extends Controller {
$allday = $_REQUEST['allday'];
$title = $_REQUEST['title'];
- $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']);
+ $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']);
$dtstart = new \DateTime($start);
if($_REQUEST['dtend']) {
- $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']);
+ $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']);
$dtend = new \DateTime($end);
}
$description = $_REQUEST['description'];
@@ -369,10 +369,10 @@ class Cdav extends Controller {
$uri = $_REQUEST['uri'];
$title = $_REQUEST['title'];
- $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']);
+ $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']);
$dtstart = new \DateTime($start);
if($_REQUEST['dtend']) {
- $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']);
+ $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']);
$dtend = new \DateTime($end);
}
$description = $_REQUEST['description'];
@@ -442,10 +442,10 @@ class Cdav extends Controller {
$allday = $_REQUEST['allday'];
$uri = $_REQUEST['uri'];
- $start = datetime_convert($tz, 'UTC', $_REQUEST['dtstart']);
+ $start = datetime_convert('UTC', 'UTC', $_REQUEST['dtstart']);
$dtstart = new \DateTime($start);
if($_REQUEST['dtend']) {
- $end = datetime_convert($tz, 'UTC', $_REQUEST['dtend']);
+ $end = datetime_convert('UTC', 'UTC', $_REQUEST['dtend']);
$dtend = new \DateTime($end);
}
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index 109b18f37..7d75a7e41 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -21,7 +21,7 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : '');
$xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : '');
- $uid = local_channel();
+ $uid = local_channel();
// only allow editing your own events.
if(($xchan) && ($xchan !== get_observer_hash()))
@@ -34,8 +34,8 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$adjust = intval($_POST['adjust']);
- $start = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtstart'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart'])));
- $finish = (($adjust) ? datetime_convert($tz, 'UTC', escape_tags($_REQUEST['dtend'])) : datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend'])));
+ $start = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtstart']));
+ $finish = datetime_convert('UTC', 'UTC', escape_tags($_REQUEST['dtend']));
$summary = escape_tags(trim($_POST['summary']));
$desc = escape_tags(trim($_POST['desc']));
diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl
index cd5e4189a..01739dd5b 100644
--- a/view/tpl/cdav_calendar.tpl
+++ b/view/tpl/cdav_calendar.tpl
@@ -58,7 +58,7 @@ $(document).ready(function() {
dayNamesShort: aStr['dayNamesShort'],
allDayText: aStr['allday'],
- snapDuration: '00:15:00',
+ snapDuration: '00:05:00',
dateClick: function(info) {
if(new_event.id) {
@@ -77,7 +77,7 @@ $(document).ready(function() {
}
- var dtend = new Date(info.date.toISOString());
+ var dtend = new Date(info.date.toUTCString());
if(allday) {
dtend.setDate(dtend.getDate() + 1);
}
@@ -93,14 +93,14 @@ $(document).ready(function() {
$('#id_description').attr('disabled', false);
$('#id_location').attr('disabled', false);
$('#calendar_select').val($("#calendar_select option:first").val()).attr('disabled', false);
- $('#id_dtstart').val(info.date.toISOString());
- $('#id_dtend').val(dtend ? dtend.toISOString() : '');
+ $('#id_dtstart').val(info.date.toUTCString().slice(0, -4));
+ $('#id_dtend').val(dtend ? dtend.toUTCString().slice(0, -4) : '');
$('#id_description').val('');
$('#id_location').val('');
$('#event_submit').val('create_event').html('{{$create}}');
$('#event_delete').hide();
- new_event = { id: new_event_id, title: 'New event', start: $('#id_dtstart').val(), end: $('#id_dtend').val(), allDay: info.allDay, editable: true, color: '#bbb' };
+ new_event = { id: new_event_id, title: 'New event', start: info.date.toUTCString(), end: dtend ? dtend.toUTCString() : '', allDay: info.allDay, editable: true, color: '#bbb' };
calendar.addEvent(new_event);
},
@@ -164,8 +164,8 @@ $(document).ready(function() {
$('#id_timezone_select').val(event.extendedProps.timezone);
$('#id_location').val(event.extendedProps.location);
$('#id_categories').tagsinput('add', event.extendedProps.categories);
- $('#id_dtstart').val(dtstart.toISOString());
- $('#id_dtend').val(dtend.toISOString());
+ $('#id_dtstart').val(dtstart.toUTCString().slice(0, -4));
+ $('#id_dtend').val(dtend.toUTCString().slice(0, -4));
$('#id_description').val(event.extendedProps.description);
$('#id_location').val(event.extendedProps.location);
$('#event_submit').val('update_event').html('{{$update}}');
@@ -217,8 +217,8 @@ $(document).ready(function() {
var dtend = new Date(info.event._instance.range.end);
$('#id_title').val(event.title);
- $('#id_dtstart').val(dtstart.toISOString());
- $('#id_dtend').val(dtend.toISOString());
+ $('#id_dtstart').val(dtstart.toUTCString().slice(0, -4));
+ $('#id_dtend').val(dtend.toUTCString().slice(0, -4));
event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : '';
@@ -232,8 +232,8 @@ $(document).ready(function() {
'preview': 0,
'summary': event.title,
'timezone_select': event.extendedProps.timezone,
- 'dtstart': dtstart.toISOString(),
- 'dtend': dtend.toISOString(),
+ 'dtstart': dtstart.toUTCString().slice(0, -4),
+ 'dtend': dtend.toUTCString().slice(0, -4),
'adjust': event.allDay ? 0 : 1,
'categories': event.extendedProps.categories,
'desc': event.extendedProps.description,
@@ -249,8 +249,8 @@ $(document).ready(function() {
'id[]': event.extendedProps.calendar_id,
'uri': event.extendedProps.uri,
'timezone_select': event.extendedProps.timezone,
- 'dtstart': dtstart ? dtstart.toISOString() : '',
- 'dtend': dtend ? dtend.toISOString() : '',
+ 'dtstart': dtstart ? dtstart.toUTCString().slice(0, -4) : '',
+ 'dtend': dtend ? dtend.toUTCString().slice(0, -4) : '',
'allday': event.allDay ? 1 : 0
})
.fail(function() {
@@ -266,8 +266,8 @@ $(document).ready(function() {
var dtend = new Date(info.event._instance.range.end);
$('#id_title').val(event.title);
- $('#id_dtstart').val(dtstart.toISOString());
- $('#id_dtend').val(dtend.toISOString());
+ $('#id_dtstart').val(dtstart.toUTCString().slice(0, -4));
+ $('#id_dtend').val(dtend.toUTCString().slice(0, -4));
event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : '';
@@ -281,8 +281,8 @@ $(document).ready(function() {
'preview': 0,
'summary': event.title,
'timezone_select': event.extendedProps.timezone,
- 'dtstart': dtstart.toISOString(),
- 'dtend': dtend.toISOString(),
+ 'dtstart': dtstart.toUTCString().slice(0, -4),
+ 'dtend': dtend.toUTCString().slice(0, -4),
'adjust': event.allDay ? 0 : 1,
'categories': event.extendedProps.categories,
'desc': event.extendedProps.description,
@@ -298,8 +298,8 @@ $(document).ready(function() {
'id[]': event.extendedProps.calendar_id,
'uri': event.extendedProps.uri,
'timezone_select': event.extendedProps.timezone,
- 'dtstart': dtstart ? dtstart.toISOString() : '',
- 'dtend': dtend ? dtend.toISOString() : '',
+ 'dtstart': dtstart ? dtstart.toUTCString().slice(0, -4) : '',
+ 'dtend': dtend ? dtend.toUTCString().slice(0, -4) : '',
'allday': event.allDay ? 1 : 0
})
.fail(function() {
@@ -367,8 +367,8 @@ $(document).ready(function() {
$('#calendar_select').val('channel_calendar').attr('disabled', true);
$('#id_title').val(resource.summary);
- $('#id_dtstart').val(new Date(resource.dtstart).toISOString());
- $('#id_dtend').val(new Date(resource.dtend).toISOString());
+ $('#id_dtstart').val(new Date(resource.dtstart).toUTCString().slice(0, -4));
+ $('#id_dtend').val(new Date(resource.dtend).toUTCString().slice(0, -4));
$('#id_categories').tagsinput('add', '{{$categories}}'),
$('#id_description').val(resource.description);
$('#id_location').val(resource.location);