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

Serializing and Deserializing RRuleSet yields different RRuleSet #98

Open
Dav1dde opened this issue Nov 7, 2023 · 2 comments
Open

Serializing and Deserializing RRuleSet yields different RRuleSet #98

Dav1dde opened this issue Nov 7, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Dav1dde
Copy link

Dav1dde commented Nov 7, 2023

The Display impl of RRuleSet only serializes the contained rrule's not any of the other information:

impl Display for RRuleSet {
/// Prints a valid set of iCalendar properties which can be used to create a new [`RRuleSet`] later.
/// You may use the generated string to create a new iCalendar component, like VEVENT.
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let properties = self
.rrule
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join("\n");
let datetime = datetime_to_ical_format(&self.dt_start);
write!(f, "DTSTART{}\n{}", datetime, properties)
}
}

I would expect the following code to yield the same RRuleSet:

rrule_set.to_string().parse::<rrule::RRuleSet>().unwrap()
@fmeringdal fmeringdal added bug Something isn't working good first issue Good for newcomers labels Nov 7, 2023
@fmeringdal
Copy link
Owner

Thanks for reporting. I will add a fix once time allows, unless someone else picks it up before then

@fmeringdal
Copy link
Owner

Proposed fix in #100 if you want to try it out before next release. It isn't a complete fix, but should hopefully cover most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants