summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Meringdal <fmeringdal@hotmail.com>2020-10-31 19:27:37 +0100
committerFredrik Meringdal <fmeringdal@hotmail.com>2020-10-31 19:27:37 +0100
commitf50129d61a65dd6372b3d12f42d989548fd666de (patch)
tree0f3b326c59066644d909be891df954c9e8c2ae95
parent4bbe0f98c06bd116d705b2f1a16b1d4f66b736d6 (diff)
downloadrust_rrule-f50129d61a65dd6372b3d12f42d989548fd666de.zip
refactor
-rw-r--r--src/datetime.rs9
-rw-r--r--src/rrulestr.rs2
2 files changed, 3 insertions, 8 deletions
diff --git a/src/datetime.rs b/src/datetime.rs
index 4702e0e..8099ad4 100644
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -1,14 +1,9 @@
use chrono::prelude::*;
-use chrono_tz::Tz;
+use chrono::Utc;
+use chrono_tz::{Tz};
pub type DTime = DateTime<Tz>;
-// pub fn from_ordinal(ordinal: isize) -> DateTime<Utc> {
-// let timestamp = ordinal * 24 * 60 * 60;
-// let naive = NaiveDateTime::from_timestamp(timestamp as i64, 0);
-// DateTime::from_utc(naive, Utc)
-// }
-
pub fn from_ordinal(ordinal: isize, tz: &Tz) -> DTime {
let timestamp = ordinal * 24 * 60 * 60;
tz.timestamp(timestamp as i64, 0)
diff --git a/src/rrulestr.rs b/src/rrulestr.rs
index 7581ab9..20670f8 100644
--- a/src/rrulestr.rs
+++ b/src/rrulestr.rs
@@ -175,7 +175,7 @@ fn parse_rrule(line: &str) -> Result<Options, RRuleParseError> {
options.bysetpos = Some(bysetpos);
}
"BYMONTH" => {
- let bymonth = stringval_to_intvec(value, |month| month >= 0 && month <= 11, format!("Invalid bymonth value"))?;
+ let bymonth = stringval_to_intvec(value, |month| month <= 11, format!("Invalid bymonth value"))?;
options.bymonth = Some(bymonth);
}
"BYMONTHDAY" => {