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 timezone issues when using rrule #329

Merged
merged 10 commits into from
Sep 2, 2024
Merged

Conversation

50an6xy06r6n
Copy link
Contributor

An alternative implementation of #231. All tests seem to pass, including the ones added in #231.

Implementation is simpler, so hopefully this should be easier to review.

test/test.js Outdated
@@ -11,6 +11,10 @@ const _ = require('underscore');
const moment = require('moment-timezone');
const ical = require('../node-ical.js');

process.on('uncaughtException', error => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should such an exception not better crash the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh this is some weird issue with vows.js where it doesn't properly catch thrown exceptions and won't tell you what the issue actually is (you get a bunch of "callback not fired" messages instead). I found this snippet online to try to fix it but it doesn't work, and I apparently forgot to take it back out. Here's what it outputs when there's a parsing error in the test:

$ npm run test

> [email protected] test
> xo && vows test/test.js && vows test/test-async.js && printf "\n"

···········································································································✗✗·

✗ Errored » callback not fired 
      in with test22.ics (testing dtstart of rrule with timezones) first event 
      in node-ical 
      in test/test.js✗ Errored » callback not fired 
      in with test22.ics (testing dtstart of rrule with timezones) second event 
      in node-ical 
      in test/test.js[
  '✗ \x1B[31m\x1B[1mErrored\x1B[22m\x1B[39m » \x1B[1m108\x1B[22m honored ∙ \x1B[1m3\x1B[22m errored ∙ \x1B[1m4\x1B[22m dropped\n'
]

On that note, vows seems hopelessly outdated. It still uses util.print, which was EOLed in Node 12.0.0. I had to make some changes in vow itself to get any useful output on errors.

@50an6xy06r6n
Copy link
Contributor Author

@Apollon77 any chance you could take another look?

@Apollon77
Copy link
Contributor

I honestly did not really looked into the change itself, but a test it´s there which is great ... And I mainly stumbled over the process.on(...) ... sooo LGTM from my side - but as said without looking too deep into the change itself and potential implications

@jens-maus
Copy link
Owner

@50an6xy06r6n Thanks for this PR. Please note, however, the failing CI checks for the windows builds. It seems some tests actually fail on the windows build of node-ical. So please correct.

@jens-maus
Copy link
Owner

@50an6xy06r6n In addition, please comment how much different this PR is compared to #231

@50an6xy06r6n
Copy link
Contributor Author

50an6xy06r6n commented Aug 16, 2024

@jens-maus Ah I think the Windows CI failures are an issue with the new tests, and have to do with this:

Moment Timezone found Etc/Unknown from the Intl api, but did not have that data loaded.

Pretty sure updating the moment-timezone import to moment-timezone-with-data will fix this, but I'll try it out. Hopefully the CI will re-run, since last time it was blocked on approval.

I think the biggest difference between this and #231 is that this is a more targeted change for the RRULE issue. The other PR I think also changes some other, unrelated behavior. I think our solutions to the RRULE issue are fundamentally the same, though we use different mechanisms for getting the local time. I copied the tests from that PR, so the behavior seems largely the same (minus the additional parsing behavior for "(GMT +XX:X0)" time zones)

The other difference is that I'm updating this PR, and that one hasn't been touched in almost 2 years 😛

@jens-maus
Copy link
Owner

@jens-maus Ah I think the Windows CI failures are an issue with the new tests, and have to do with this:

Moment Timezone found Etc/Unknown from the Intl api, but did not have that data loaded.

Pretty sure updating the moment-timezone import to moment-timezone-with-data will fix this, but I'll try it out. Hopefully the CI will re-run, since last time it was blocked on approval.

No problem. I can then start the CI check if it is still rejected for you. So please continue to fix this PR in getting the windows CI build running. However, please make sure that moment-timezone-with-data is really required since it is substantially larger than the normal moment-timezone and would substantially increase the overall size of code required when using node-ical.

Windows hosts don't seem to recognize the Etc/GMT-2 timezone that's used
in test22, so this should load that. Since it's only used in the test I don't
think it should increase the bundle size
A different test22.ics has been added as part of jens-maus#332
@50an6xy06r6n
Copy link
Contributor Author

@jens-maus ready for the CI checks to be re-run

@jens-maus
Copy link
Owner

@jens-maus ready for the CI checks to be re-run

Thanks for your info. However, the unit tests still fail on windows. See:

    with test23.ics (testing dtstart of rrule with timezones) recurring yearly first event (14 july) 
      ✗ dt start well set 
        » An unexpected error was caught: RangeError: Invalid time zone specified: Etc/Unknown 

@jens-maus
Copy link
Owner

@50an6xy06r6n it seems rrule.between is somewhat broken on windows. Similar things are reported for rrule.after, see jkbrzt/rrule#608. Thus changed the test cases to somewhat skip on windows until rrule is fixed.

@jens-maus jens-maus merged commit a09d97c into jens-maus:master Sep 2, 2024
15 checks passed
@50an6xy06r6n
Copy link
Contributor Author

50an6xy06r6n commented Sep 2, 2024

Oh nice, thanks for investigating and fixing it!

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.

3 participants