Skip to content

Commit

Permalink
Merge pull request #111 from tomquist/tom/fix-display-wkst
Browse files Browse the repository at this point in the history
fix: render weekdays as valid rrule strings
  • Loading branch information
fmeringdal authored May 19, 2024
2 parents ec5a9b9 + 95e7256 commit dee6785
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rrule/src/core/rrule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl<S> Display for RRule<S> {

// Monday is the default, no need to expose it.
if self.week_start != Weekday::Mon {
res.push(format!("WKST={}", &self.week_start));
res.push(format!("WKST={}", weekday_to_str(self.week_start)));
}

if !self.by_set_pos.is_empty() {
Expand Down
11 changes: 10 additions & 1 deletion rrule/src/tests/regression.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use chrono::Month;

use crate::tests::common;
use crate::{Frequency, RRule, RRuleSet};
use crate::{Frequency, RRule, RRuleSet, Unvalidated};

#[test]
fn issue_34() {
Expand Down Expand Up @@ -60,3 +60,12 @@ fn issue_97() {
"FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=24,25,26"
);
}

#[test]
fn issue_111() {
let rrule = "RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU;WKST=SU".parse::<RRule<Unvalidated>>();

// Convert to string...
let rrule_str = format!("{}", rrule.unwrap());
assert!(rrule_str.contains("WKST=SU"));
}

0 comments on commit dee6785

Please sign in to comment.