tritech / node-icalendar

iCalendar parser and generator for Node.js
MIT License
233 stars 50 forks source link

Bug or local misconfiguration? On my local installation 3 Tests are red #15

Closed leider closed 10 years ago

leider commented 10 years ago

Transcript:

  1) RRule respects COUNT parts
   Message:
     Expected [ Date(Sat Jan 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 00:00:00 GMT+0100 (CET)) ] to equal [ Date(Sat Jan 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Mar 01 2011 00:00:00 GMT+0100 (CET)) ].
   Stacktrace:
     Error: Expected [ Date(Sat Jan 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 00:00:00 GMT+0100 (CET)) ] to equal [ Date(Sat Jan 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 00:00:00 GMT+0100 (CET)), Date(Tue Mar 01 2011 00:00:00 GMT+0100 (CET)) ].
    at null.<anonymous> (/JavascriptDev/node-icalendar/spec/rrule-spec.js:43:18)

  2) RRule respects EXDATE full date parts
   Message:
     Expected [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)) ] to equal [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)), Date(Sun May 01 2011 10:00:00 GMT+0200 (CEST)) ].
   Stacktrace:
     Error: Expected [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)) ] to equal [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)), Date(Sun May 01 2011 10:00:00 GMT+0200 (CEST)) ].
    at null.<anonymous> (/JavascriptDev/node-icalendar/spec/rrule-spec.js:84:18)

  3) VEvent objects uses EXDATE properties when calculating recurrence
   Message:
     Expected [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)) ] to equal [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)), Date(Sun May 01 2011 10:00:00 GMT+0200 (CEST)) ].
   Stacktrace:
     Error: Expected [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Tue Feb 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)) ] to equal [ Date(Sat Jan 01 2011 10:00:00 GMT+0100 (CET)), Date(Fri Apr 01 2011 10:00:00 GMT+0200 (CEST)), Date(Sun May 01 2011 10:00:00 GMT+0200 (CEST)) ].
    at null.<anonymous> (/JavascriptDev/node-icalendar/spec/vevent-spec.js:124:18)
james-emerton commented 10 years ago

I suspect this may have something to do with your timezone (although we use UTC for all recurrence calculations.) Is it possible that March 1st does not exist in your timezone? =)

leider commented 10 years ago

It definitely is a time zone problem. When I go west the errors disappear. So you could also experience failing tests by setting your machine's time zone east of Greenwich.

Am 21.11.2013 um 02:29 schrieb James Emerton notifications@github.com:

I suspect this may have something to do with your timezone (although we use UTC for all recurrence calculations.) Is it possible that March 1st does not exist in your timezone? =)

— Reply to this email directly or view it on GitHub.

leider commented 10 years ago

Diving throughout the code for some time. it is hard tp see where local dates are used or where utc comes in. There is a lot of stuff done manually that could be much easier by using http://momentjs.com/timezone/

Perhaps you should have a closer look at these.

Also, are you sure to always have UTC stuff when you think you do? UTC is a way to display a Date. Javascript Dates are UTC by default. The only thing that is timezone aware is the representation!

RBLU commented 10 years ago

I see the same behaviour when I try to use the RRule.getNextOccurances() with a COUNT rule

By debugging through the code I noticed several issues in RRule.js with timezones, it seems to me that the RRule.to_utc_date is actually correcting in the wrong direction whenever the system timezone is not UTC - on the other hand I don't really understand the code there, so I might be wrong with that analysis.

Our servers run on UTC so this not an issue there - but unittests run on developers laptops in all kinds of timezones...

I can also see 4 failing unittests whenever my System Timezone is not UTC, as soon as I switch the laptops timezone to UTC all tests pass.

I tried fixing this, but I keep breaking other tests