digitalfondue / lavagna

Lavagna: issue tracker/project management tool
http://lavagna.io
GNU General Public License v3.0
636 stars 110 forks source link

Calendar feed: use UTC in card and milestone due date #77

Closed sebastianopilla closed 7 years ago

sebastianopilla commented 7 years ago

This PR intends to fix an issue close to #70: when loading the calendar feed into a calendar application, due dates have no timezone indication and thus may appear earlier or later than the actual date .

For example, when I set a due date for 2017-04-03, my server which is in the Europe/Paris timezone outputs a calendar entry such as:

BEGIN:VEVENT
DTSTAMP:20170402T154957Z
DTSTART;VALUE=DATE;VALUE=DATE:20170402
SUMMARY:TECH-24 Test notification 2 (OPEN)
CREATED:20170402T145334Z
LAST-MODIFIED:20170402T153717Z
UID:00000005-0000-0018-0000-000600000006
ORGANIZER;CN=datafaber:MAILTO:admin@datafaber.net
URL:https://tasks.datafaber.net/BASE/TECH-24
DESCRIPTION:Test notification in progress
BEGIN:VALARM
TRIGGER:PT0S
ACTION:DISPLAY
DESCRIPTION:TECH-24 Test notification 2 (OPEN)
END:VALARM
END:VEVENT

where the actual due date appears in the JSON responses from Lavagna as:

            "labelColor": 0,
            "labelDomain": "SYSTEM",
            "labelId": 6,
            "labelName": "DUE_DATE",
            "labelProjectId": 2,
            "labelType": "TIMESTAMP",
            "labelUnique": true,
            "labelValueCard": null,
            "labelValueCardId": 24,
            "labelValueId": 6,
            "labelValueInt": null,
            "labelValueLabelId": 6,
            "labelValueList": null,
            "labelValueString": null,
            "labelValueTimestamp": "2017-04-02T22:00:00.000Z",
            "labelValueType": "TIMESTAMP",
            "labelValueUseUniqueIndex": true,
            "labelValueUser": null,
            "value": {
                "valueCard": null,
                "valueInt": null,
                "valueList": null,
                "valueString": null,
                "valueTimestamp": "2017-04-02T22:00:00.000Z",
                "valueUser": null
            }

The 2-hours difference with GMT and the loss of the time component make calendar applications believe that this due date is Apr, 2 2017 at midnight, which is a day earlier than intended.

Due dates for milestones have the same issue.

With the changes from this pull request, due dates for cards and milestones are exported in UTC time so that calendar applications can correctly display dates and reminders.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.01%) to 70.636% when pulling b7be3fa7180877ab3f63d140b3f8a24dc7b5a4f0 on sebastianopilla:master into 4784ccce2b0565a35e5d2816d8d6ba5a642e8e9d on digitalfondue:master.

syjer commented 7 years ago

Hi @sebastianopilla , thank you for the PR :).

We will merge it as soon as possible!

SitoCH commented 7 years ago

Thank you @sebastianopilla for the PR. I tested it with Outlook 2010 and works as expected, the strange thing is that Outlook worked fine also with the current version. With what application are you using the feed?

sebastianopilla commented 7 years ago

@SitoCH Happy that it works for you as well. I've made this PR because I was seeing the wrong dates in both the latest Thunderbird 45.8.0 with the Lightning extension and in Google Calendar.

SitoCH commented 7 years ago

I checked the PR also with the macOS's Calendar and it's ok.

Thank you very much for helping us improve Lavagna!