Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Issue #1798 - fixing recurrent calendar events crosstime DST #1884

Merged

Conversation

kblankenship1989
Copy link
Contributor

Issue #1798 - converting to Local times for JS Date Objects before submitting to 'rrule' library. Issue appears to be in Rrule.between() function where date and time are broken apart and then put back together, it looses reference to timezone with the UTC time passed.

Fix - trick the function to thinking local time is UTC time and then convert back to UTC time after array of recurring events is returned.

Files impacted

  • modules/default/calendar/calendarfetcher.js
  • modules/default/calendar/vendor/ical.js/node_ical.js

Example:

  • Event every day @ 7:30 CST created on 10/16/2019
  • Daylight Savings Time was applicable at this time, so 7:30 CST -> 12:30 UTC
  • Convert start time to 7:30 UTC (2:30 CST) by adding the timezone offset
  • Generate array of start dates using 7:30 UTC
  • Convert all start dates back to regular 7:30 CST by subtracting timezone offset (-5 /-6 respectively based on Daylight Savings Time)

Additional changes - Ran lint and inadvertently changed 8 other files.

@MichMich MichMich merged commit d6f1bf1 into MagicMirrorOrg:develop Jan 18, 2020
@kblankenship1989 kblankenship1989 deleted the fix-timeshift-calendar branch January 18, 2020 20:38
@@ -26,6 +26,17 @@ exports.parseFile = function(filename){

var rrule = require('rrule').RRule

function getLocaleISOString(date) {
var year = date.getFullYear().toString(10).padStart(4,'0');
var month = date.getMonth().toString(10).padStart(2,'0');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getMonth() returns a month between 0 and 11, not between 1 and 12 so this creates an invalid date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the catch. I just put up PR #1914 to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants