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

Errors with dates before Jan 1, 1970 #791

Closed
amcolash opened this issue Mar 25, 2017 · 11 comments
Closed

Errors with dates before Jan 1, 1970 #791

amcolash opened this issue Mar 25, 2017 · 11 comments

Comments

@amcolash
Copy link
Contributor

I think that I have some calendar events that somehow start before Jan 1, 1970 - can't say I know which of them is to blame here but I am assuming that this is a birthday. I was looking through the logs and kept seeing:

0|mm       | Error: dates lower than Thu Jan 01 1970 00:00:00 GMT-0600 (CST) are not supported
0|mm       |     at Object.toOrdinal (/home/pi/MagicMirror/node_modules/rrule-alt/lib/rrule.js:105:15)
0|mm       |     at Iterinfo.rebuild (/home/pi/MagicMirror/node_modules/rrule-alt/lib/rrule.js:1409:35)
0|mm       |     at RRule._iter (/home/pi/MagicMirror/node_modules/rrule-alt/lib/rrule.js:978:10)
0|mm       |     at RRule.between (/home/pi/MagicMirror/node_modules/rrule-alt/lib/rrule.js:794:21)
0|mm       |     at /home/pi/MagicMirror/modules/default/calendar/calendarfetcher.js:112:24
0|mm       |     at Request._callback (/home/pi/MagicMirror/modules/default/calendar/vendor/ical.js/node-ical.js:11:5)
0|mm       |     at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:188:22)
0|mm       |     at emitTwo (events.js:106:13)
0|mm       |     at Request.emit (events.js:191:7)
0|mm       |     at Request.<anonymous> (/home/pi/MagicMirror/node_modules/request/request.js:1171:10)

I think that we should probably gracefully change their start dates to Jan 1, 1970 (if we are not calculating ages when showing B-Days). I might have some time in the next few days to work on a PR.

@roramirez
Copy link
Contributor

Here is a thing related.
jkbrzt/rrule#125

I don't if the rrule project include this into and what kind impact can will be. Are you propose keep a rrule patched for this kind of case?

@amcolash
Copy link
Contributor Author

amcolash commented Mar 26, 2017

Interesting. I am not sure of the impact of changing dates we try and parse. If that causes issues I think that it would be best to have a patched rrule version if that PR is not merged.

EDIT:
Doing some more research into the issue, looks like JS is more than capable of dealing with dates before 1970 (since the min/max dates able to be defined are much larger than that). http://stackoverflow.com/questions/27093130/how-to-get-the-minimum-and-maximum-date

@amcolash
Copy link
Contributor Author

I edited my local version of rrule by changing dateUtil.ORDINAL_BASE = new Date(1970, 0, 1); to dateUtil.ORDINAL_BASE = new Date(1900, 0, 1); which works for me. I am assuming that there is a better way. Without this hack however, I am not able to see some of my calendar events because rrule kills the calendar thread early.

@roramirez
Copy link
Contributor

This is related with #839. Some calendar are not loaded maybe containt events before Jan 1, 1970

@tgeimer
Copy link

tgeimer commented Apr 18, 2017

Thank you! changing the ORDINAL_BASE worked for me.

@nhubbard
Copy link
Contributor

This issue is called epoch time. It is how Unix (and by extent, Linux) systems count time. It starts on January 1st, 1970. This issues makes complete sense, considering that negative time doesn't exist.

@berlincount
Copy link
Contributor

Sorry, but I don't think limited representability in one of the underlying formats is a good reason to not support times outside that formats range ;)

@roramirez
Copy link
Contributor

@berlincount
Recently I added comment here about that
#839 (comment)

@nhubbard
Copy link
Contributor

@berlincount I mean, yes, JavaScript supports going before that, but it doesn't make sense unless you patch the kernel. Which is annoying and weird. In this case, you can edit the ORDINAL_BASE as said above.

@amcolash
Copy link
Contributor Author

Seems like ruule-alt isn't much more supported than just rrule. I wonder if there are other repeating rule js libraries out there (haven't checked but might be worth it).

@MichMich
Copy link
Collaborator

MichMich commented Sep 6, 2017

Closed due to inactivity. Feel free to reopen.

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

No branches or pull requests

6 participants