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

Date parsing fails when explicit timezone identifier string is present #3

Closed
aggregat4 opened this issue Nov 16, 2020 · 6 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@aggregat4
Copy link

Using rrule 3.4.0 and doing the following test:

 #[test]
    fn rruleset_parsing_date_with_timezone() {
        "DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":20201111T160000\nRRULE:FREQ=WEEKLY;UNTIL=20210428T140000Z;INTERVAL=6;BYDAY=WE;WKST=MO".parse::<RRuleSet>().unwrap();
    }

causes the error:

thread 'meeters_ical::tests::rruleset_parsing_date_with_timezone' panicked at 'called `Result::unwrap()` on an `Err` value: RRuleParseError("Invalid datetime: 00)")', src/meeters_ical.rs:310:195
@fmeringdal
Copy link
Owner

Right now this crate only has support for timezones that are specified in the IANA database. But the goal is certainly to be able to support other timezone formats as well. I will put some effort into supporting fixed offset timezone strings (like the one you provided), and hope to have it ready for v.3.5.0.

@fmeringdal fmeringdal added the enhancement New feature or request label Nov 16, 2020
@fmeringdal fmeringdal self-assigned this Nov 16, 2020
@aggregat4
Copy link
Author

Much appreciated! I know the pain with this date parsing since in the application I'm writing using your library I was already parsing dates and it is kind of stupefying how many variants the ical spec allows.

Do you think it may be useful to split out the date parsing bits into some common library?

@fmeringdal
Copy link
Owner

fmeringdal commented Nov 17, 2020

Yeah there is certainly a lot of complexity to parsing all the different kinds of ical strings.
Both the chrono and chrono-tz crates help a lot with parsing dates, datetimes and timezones (IANA timezone) from strings. Actually it is not that much work needed to parse the timezone strings that are not supported by chrono-tz (some new regex will get the job done), so I think it is okay to just keep all of the string parsing stuff within this crate for now.

@aggregat4
Copy link
Author

@fmeringdal do you know of a good workaround for specifying the timezone? I can preprocess the ical, but just stripping the timezone causes alls dates to be UTC. Is there an alternative way to indicate the timezone that your library supports?

@fmeringdal
Copy link
Owner

@aggregat4 I am still not sure how to convert between the Tz enum (provided by chrono-tz) that I use internally in this crate and a given UTC offset that I get from parsing the rrule string. My plan is to take a deeper look into all of this this weekend or the next. Please let me know if you have some ideas on how to do this!

@aggregat4 aggregat4 changed the title Date parsing fails when explizit timezone identifier string is present Date parsing fails when explicit timezone identifier string is present Dec 17, 2020
@fmeringdal
Copy link
Owner

#24 Replaces this issue. Feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants