1up-lab/contao-ical-export

Set timezone in iCal file

Kahmoon opened this issue Β· 26 comments

Hi,

actually we have some students which have a problem in events which they downloaded via ical. Sometimes the start and end date is shifting an hour. For example this event is from 8 - 12. When they download the ical this is set correctly. But sometimes this value is shifting +1h. So the event in their (iphone) calendar is now from 9-13, which is a problem because they are missing the event.

I cannot reproduce this behavior but can you set the timezone in ical itself? I cannot see a value here and i think this should be the problem. It should use the value which is set in contao settings.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:https://www.meineurl.de
BEGIN:VEVENT
UID:6193fe01d3092
DTSTART:20211121T080000
SEQUENCE:0
TRANSP:OPAQUE
DTEND:20211121T120000
LOCATION:Arnbacher Str. 3\, 85229 Markt Indersdorf
SUMMARY:Fallenlehrgang - Vormittag (M-2109)
CLASS:PUBLIC
DTSTAMP:20211116T185249Z
END:VEVENT
END:VCALENDAR

Bildschirmfoto 2021-11-21 um 14 54 47

On Wikipedia i found some ical timezone settings which can be used.
SCR-20211121-krb

https://de.wikipedia.org/wiki/ICalendar


  BEGIN:VTIMEZONE
    TZID:Europe/Berlin
    BEGIN:STANDARD
      DTSTART:16011028T030000
      RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
      TZOFFSETFROM:+0200
      TZOFFSETTO:+0100
    END:STANDARD
    BEGIN:DAYLIGHT
      DTSTART:16010325T020000
      RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
      TZOFFSETFROM:+0100
      TZOFFSETTO:+0200
    END:DAYLIGHT
  END:VTIMEZONE

Good find, I'll add the timezone information accordingly to the system setting πŸ‘

Which Contao and PHP version are you using?

PHP 7.4
Contao 4.12.3

Some of my students provided me a screenshot. Some devices think they are "smart" and use UTC as timezone because no timezone is set. Thats probably the reason why times are shifting.

IMG_5942

Funny, because using UTC is explicitely set to false. But I'm on it, will provide it with the correct timezone data πŸ‘

Probably some Apple iPhones are not caring about this setting :-P. Im using this very intense and never had this problem. Also no other students reported this to us the last years. Actually there are 3 from actual courses which have this problem.

@Kahmoon can you test the branch feature/add-timezone in your installation and provide me some feedback, if it's working?
The composer constraint should be dev-feature/add-timezone as 2.1.0.

I donΒ΄t know how to do that :-(

Can you adjust the package with "oneup/contao-ical-export": "dev-feature/add-timezone as 2.1.0" in your composer.json and run a composer update? :)

Actually our hosting at IONOS is down ;-)

Here is my composer.json

{
    "type": "project",
    "require": {
        "bugbuster/contao-dlstats-bundle": "^1.0",
        "codefog/contao-cookiebar": "^2.1",
        "codefog/contao-events_subscriptions": "dev-develop as 2.13.0",
        "contao-bootstrap/core": "^2.0",
        "contao-bootstrap/grid": "^2.3",
        "contao-bootstrap/layout": "^2.0",
        "contao-bootstrap/navbar": "^2.1",
        "contao/calendar-bundle": "4.12.*",
        "contao/comments-bundle": "4.12.*",
        "contao/conflicts": "*@dev",
        "contao/faq-bundle": "4.12.*",
        "contao/listing-bundle": "4.12.*",
        "contao/manager-bundle": "4.12.*",
        "contao/news-bundle": "4.12.*",
        "contao/newsletter-bundle": "4.12.*",
        "dklemmt/contao_dk_mmenu": "^3.2",
        "do-while/contao-backupdb-bundle": "^1.3",
        "erdmannfreunde/euf_overlay": "^1.3",
        "frank-berger/events-subscriptions": "1.0.8",
        "heimrichhannot/contao-teaser-bundle": "^1.0.0",
        "hofff/contao-calendarfield": "^3.0",
        "jrgregory/m17-sticky-backend-footer": "^2.0",
        "madeyourday/contao-rocksolid-custom-elements": "^2.2",
        "madeyourday/contao-rocksolid-frontend-helper": "^2.0",
        "markocupic/resource-booking-bundle": "^2.4",
        "netzmacht/contao-font-awesome-inserttag": "^2.0",
        "omosde/contao-om-backend": "^1.6",
        "oneup/contao-ical-export": "^2.0",
        "phpoffice/phpspreadsheet": "^1.14",
        "terminal42/contao-easy_themes": "^2.2",
        "terminal42/contao-leads": ">=1.4.10.0,<1.5-dev",
        "terminal42/contao-pageimage": "^4.1",
        "terminal42/notification_center": "^1.4"
    },
    "extra": {
        "contao-component-dir": "assets"
    },
    "conflict": {
        "doctrine/doctrine-bundle": "<1.12.8"
    },
    "scripts": {
        "post-install-cmd": [
            "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
        ],
        "post-update-cmd": [
            "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
        ]
    }
}

it should be like this?

{
    "type": "project",
    "require": {
        "bugbuster/contao-dlstats-bundle": "^1.0",
        "codefog/contao-cookiebar": "^2.1",
        "codefog/contao-events_subscriptions": "dev-develop as 2.13.0",
        "contao-bootstrap/core": "^2.0",
        "contao-bootstrap/grid": "^2.3",
        "contao-bootstrap/layout": "^2.0",
        "contao-bootstrap/navbar": "^2.1",
        "contao/calendar-bundle": "4.12.*",
        "contao/comments-bundle": "4.12.*",
        "contao/conflicts": "*@dev",
        "contao/faq-bundle": "4.12.*",
        "contao/listing-bundle": "4.12.*",
        "contao/manager-bundle": "4.12.*",
        "contao/news-bundle": "4.12.*",
        "contao/newsletter-bundle": "4.12.*",
        "dklemmt/contao_dk_mmenu": "^3.2",
        "do-while/contao-backupdb-bundle": "^1.3",
        "erdmannfreunde/euf_overlay": "^1.3",
        "frank-berger/events-subscriptions": "1.0.8",
        "heimrichhannot/contao-teaser-bundle": "^1.0.0",
        "hofff/contao-calendarfield": "^3.0",
        "jrgregory/m17-sticky-backend-footer": "^2.0",
        "madeyourday/contao-rocksolid-custom-elements": "^2.2",
        "madeyourday/contao-rocksolid-frontend-helper": "^2.0",
        "markocupic/resource-booking-bundle": "^2.4",
        "netzmacht/contao-font-awesome-inserttag": "^2.0",
        "omosde/contao-om-backend": "^1.6",
        "oneup/contao-ical-export": "dev-feature/add-timezone as 2.1.0",
        "phpoffice/phpspreadsheet": "^1.14",
        "terminal42/contao-easy_themes": "^2.2",
        "terminal42/contao-leads": ">=1.4.10.0,<1.5-dev",
        "terminal42/contao-pageimage": "^4.1",
        "terminal42/notification_center": "^1.4"
    },
    "extra": {
        "contao-component-dir": "assets"
    },
    "conflict": {
        "doctrine/doctrine-bundle": "<1.12.8"
    },
    "scripts": {
        "post-install-cmd": [
            "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
        ],
        "post-update-cmd": [
            "Contao\\ManagerBundle\\Composer\\ScriptHandler::initializeApplication"
        ]
    }
}

yes πŸ‘

OK, i will try as soon as our hosting is working again ;-)

OK, the first thing i can see is that this update destroyed existing modules at articles. I had to reasign this content element.

Also i get an error page when clicking on ical download.

[2021-11-30T11:05:19.501555+01:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: "You have requested a non-existent service "oneup.contao.ical_bundle.calendar_creator"." at /homepages/46/xxxx/htdocs/xxx-dev/vendor/symfony/dependency-injection/Container.php line 289 {"exception":"[object] (Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException(code: 0): You have requested a non-existent service \"oneup.contao.ical_bundle.calendar_creator\". at /homepages/46/xxxx/htdocs/xxx-dev/vendor/symfony/dependency-injection/Container.php:289)"} []

OK, the first thing i can see is that this update destroyed existing modules at articles.

I doubt that this extension changes anything in the database, it has only read access to events :)

I'll check the issue. Do you have a managed edition?

Can you run a composer update to test the latest changes? πŸ™ƒ

Error is gone. I sent the ical file to one student which had this problem. I will give you feedback asap.

The event link is also implemented?! Nice! But it is the URL with parameter ?ical. It should be the link without the downloadparameter. Actually you click the link in your calendar and it will open the download of the already existing ical.

Hmm, correct. I'll have to remove the param upfront.

Is there a new version without parameter yet?

Not yet. Does the timezone fix work?

Yes, seems to be fine!

Can you composer update and check, if the link is now correct?

Actually the ical download is not possible. The url has several fragments "?ics=1&ics=1&ics=1"

https://dev.mydomain.de/preview.php/intern/termin/test-3-05-11-2020-6798.html?ics=1&ics=1&ics=1

Ahh in first place its ?ics=1

When i click the link the page reloads (without starting a download) and then its ?ics=1&ics=1

Every click...one more fragment

Sorry, my fault πŸ™ˆ Can you update and check again?

Seems to be fine! Thx

Release 2.1.0 has been published.

Your composer constraint should look like "oneup/contao-ical-export": "^2.1", now.