summaryrefslogtreecommitdiff
path: root/src/parse_options.rs
diff options
context:
space:
mode:
authorFredrik Meringdal <fmeringdal@hotmail.com>2020-12-16 16:32:26 +0100
committerFredrik Meringdal <fmeringdal@hotmail.com>2020-12-16 16:32:26 +0100
commit2c70b134b5d6bd8a49749fed348ae0e6958f8455 (patch)
tree4b6024c8795071f5984e59287cdd65169a4ce1b5 /src/parse_options.rs
parent0060c162120c96dabbd78113c29d516d83828f14 (diff)
downloadrust_rrule-2c70b134b5d6bd8a49749fed348ae0e6958f8455.zip
numeric identifier when n=1 bug
Diffstat (limited to 'src/parse_options.rs')
-rw-r--r--src/parse_options.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/parse_options.rs b/src/parse_options.rs
index 028686d..7953887 100644
--- a/src/parse_options.rs
+++ b/src/parse_options.rs
@@ -1,4 +1,4 @@
-use crate::options::{Frequenzy, NWeekday, Options, ParsedOptions, RRuleParseError};
+use crate::options::{Frequenzy, NWeekday, NWeekdayIdentifier, Options, ParsedOptions, RRuleParseError};
use crate::utils::is_some_and_not_empty;
use chrono::prelude::*;
use chrono_tz::{Tz, UTC};
@@ -70,7 +70,7 @@ pub fn parse_options(options: &Options) -> Result<ParsedOptions, RRuleParseError
}
Frequenzy::Weekly => {
partial_options.byweekday =
- Some(vec![NWeekday::new(dtstart.weekday() as usize, 1)]);
+ Some(vec![NWeekday::new(dtstart.weekday() as usize, NWeekdayIdentifier::Every)]);
}
_ => (),
};
@@ -99,11 +99,19 @@ pub fn parse_options(options: &Options) -> Result<ParsedOptions, RRuleParseError
if let Some(opts_byweekday) = partial_options.byweekday {
for wday in opts_byweekday {
- if wday.n == 1 {
- byweekday.push(wday.weekday);
- } else {
- bynweekday.push(vec![wday.weekday as isize, wday.n]);
+ match wday.n {
+ NWeekdayIdentifier::Every => {
+ byweekday.push(wday.weekday)
+ }
+ NWeekdayIdentifier::Identifier(n) => {
+ bynweekday.push(vec![wday.weekday as isize, n]);
+ }
}
+ // if wday.n == {
+ // byweekday.push(wday.weekday);
+ // } else {
+ // bynweekday.push(vec![wday.weekday as isize, wday.n]);
+ // }
}
}