Code Monkey home page Code Monkey logo

Comments (3)

sdetweil avatar sdetweil commented on July 22, 2024

yes the rrule processor has trouble with some date combinations.

not our code. and we can't tell as we don't process the ics file in MagicMirror code

from magicmirror.

morozgrafix avatar morozgrafix commented on July 22, 2024

I did a little bit more digging and the extra day is added in calendarfetcherutils.js around line 300:

// RRule can generate dates with an incorrect recurrence date. Process the array here and apply date correction.
					if (hasByWeekdayRule) {
						Log.debug("Rule has byweekday, checking for correction");
						dates.forEach((date, index, arr) => {
							// NOTE: getTimezoneOffset() is negative of the expected value. For America/Los_Angeles under DST (GMT-7),
							// this value is +420. For Australia/Sydney under DST (GMT+11), this value is -660.
							const tzOffset = date.getTimezoneOffset() / 60;
							const hour = date.getHours();
							if ((tzOffset < 0) && (hour < -tzOffset)) { // east of GMT
								Log.debug(`East of GMT (tzOffset: ${tzOffset}) and hour=${hour} < ${-tzOffset}, Subtracting 1 day from ${date}`);
								arr[index] = new Date(date.valueOf() - oneDayInMs);
							} else if ((tzOffset > 0) && (hour >= (24 - tzOffset))) { // west of GMT
								Log.debug(`West of GMT (tzOffset: ${tzOffset}) and hour=${hour} >= 24-${tzOffset}, Adding 1 day to ${date}`);
								arr[index] = new Date(date.valueOf() + oneDayInMs);
							}
						});
			 

if I’m not mistaken the time zone is set to null just before that code is executed. I think if calendar/event is matching the local time zone the adjustment shouldn’t be made. I tried to comment out the code above and it displays the date correctly, but of course it breaks some of the existing tests. I think that it needs additional checks before execution. Maybe checking that event timezone doesn’t match local timezone (although I didn’t dig into the code much yet)

thanks

from magicmirror.

sdetweil avatar sdetweil commented on July 22, 2024

that's my code trying to deal with this problem. no good fix yet

from magicmirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.