jkbrzt/rrule

rrule.after method doesn't work if there is a TZID in the dtstart

Remmelt13 opened this issue · 1 comments

Reporting an issue

The new version >2.7.2 breaks the after method if the rrule string includes a tzid. timezone on the machine is CET. It is also happening on the demo app setting tzid breaks the output of rrule.all()

Code:
const date = new Date() const rrule = "DTSTART;TZID=Europe/Berlin:20231120T110012\nRRULE:FREQ=DAILY;INTERVAL=1" const tempRule = rrulestr(rrule); const nextOccurrence = tempRule.after(date, true)

Stack trace
RangeError: Invalid time zone specified: Etc/Unknown at Date.toLocaleString (<anonymous>) at dateTZtoISO8601 (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/dateutil.ts:207:24) at tzOffset (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/dateutil.ts:215:34) at t2.rezonedDate (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/dateutil.ts:219:36) at rezoneIfNeeded (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/iter/index.ts:152:47) at iter (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/iter/index.ts:78:33) at t2._iter (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/rrule.ts:129:12) at t2.after (/Users/rem_h1/Upwell/invoice-app/node_modules/rrule/dist/es5/webpack:/rrule/src/rrule.ts:234:21)

Thank you for taking an interest in rrule! Please include the following in
your report:

  • [x ] Verify that you've looked through existing issues for duplicates before
    creating a new one
  • [ x] Code sample reproducing the issue. Be sure to include all input values you
    are using such as the exact RRule string and dates.
  • Expected output
  • [ x] Actual output
  • [ x] The version of rrule you are using
  • [ x] Your operating system
  • [ x] Your local timezone (run $ date from the command line
    of the machine showing the bug)

Having the same issue. My logs:

LOG  recurrenceRule
LOG  DTSTART;TZID=America/Chicago:20231211T023500
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR;UNTIL=20231218T023500
LOG  RRule.fromString(recurrenceRule).all()
LOG  [Date { NaN }, Date { NaN }, Date { NaN }, Date { NaN }]