diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c19bf1e..390c802 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - { name: macOS, os: macos-latest, triple: x86_64-apple-darwin } - { name: Windows, os: windows-2022, triple: x86_64-pc-windows-msvc } version: - - 1.64.0 # MSRV + - 1.70.0 # MSRV - stable steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3e794..a051db4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.12.0 (2023-xx-xx) + +- Fix to ensure freq is capitalized in the string representation +- MSRV is bumped to `v1.70.0` from `v1.64.0` + ## 0.11.0 (2023-07-18) ### Changed diff --git a/Cargo.toml b/Cargo.toml index d7a69c6..88b6c33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,14 @@ [workspace.package] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.64.0" +rust-version = "1.70.0" [workspace] members = [ "rrule", "rrule-debugger", ] +resolver = "2" # These are the 2 packages to mainly work on. # So `cargo test` and `cargo run` both work. diff --git a/rrule/src/core/rrule.rs b/rrule/src/core/rrule.rs index d7cfd2a..b3fadde 100644 --- a/rrule/src/core/rrule.rs +++ b/rrule/src/core/rrule.rs @@ -43,13 +43,13 @@ pub enum Frequency { impl Display for Frequency { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let name = match self { - Self::Yearly => "yearly", - Self::Monthly => "monthly", - Self::Weekly => "weekly", - Self::Daily => "daily", - Self::Hourly => "hourly", - Self::Minutely => "minutely", - Self::Secondly => "secondly", + Self::Yearly => "YEARLY", + Self::Monthly => "MONTHLY", + Self::Weekly => "WEEKLY", + Self::Daily => "DAILY", + Self::Hourly => "HOURLY", + Self::Minutely => "MINUTELY", + Self::Secondly => "SECONDLY", }; write!(f, "{}", name) } @@ -111,7 +111,7 @@ fn n_weekday_cmp(val1: NWeekday, val2: NWeekday) -> Ordering { impl PartialOrd for NWeekday { fn partial_cmp(&self, other: &Self) -> Option { - Some(n_weekday_cmp(*self, *other)) + Some(self.cmp(other)) } } diff --git a/rrule/src/tests/regression.rs b/rrule/src/tests/regression.rs index 95ebc32..debfbc2 100644 --- a/rrule/src/tests/regression.rs +++ b/rrule/src/tests/regression.rs @@ -1,5 +1,7 @@ +use chrono::Month; + use crate::tests::common; -use crate::RRuleSet; +use crate::{Frequency, RRule, RRuleSet}; #[test] fn issue_34() { @@ -45,3 +47,16 @@ fn issue_61() { let res = rrule_set.all(10).dates; assert_eq!(res.len(), 10); } + +// Frequency should be capitalized +#[test] +fn issue_97() { + let rrule = RRule::new(Frequency::Yearly) + .by_month_day((24..=26).collect()) + .by_month(&[Month::December]); + + assert_eq!( + rrule.to_string(), + "FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=24,25,26" + ); +}