summaryrefslogtreecommitdiff
path: root/src/iterinfo.rs
diff options
context:
space:
mode:
authorFredrik Meringdal <fmeringdal@hotmail.com>2020-10-15 01:15:17 +0200
committerFredrik Meringdal <fmeringdal@hotmail.com>2020-10-15 01:15:17 +0200
commit20d78ed504961540820fa78f82aec10cd935d60d (patch)
tree456f41675c431ab50b544ec41cdb14e3a793fd4a /src/iterinfo.rs
parent7c87042b8358b48f675a04dee4f3e985947a0861 (diff)
downloadrust_rrule-20d78ed504961540820fa78f82aec10cd935d60d.zip
daily also works!!!
Diffstat (limited to 'src/iterinfo.rs')
-rw-r--r--src/iterinfo.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/iterinfo.rs b/src/iterinfo.rs
index 475cd23..04fdb77 100644
--- a/src/iterinfo.rs
+++ b/src/iterinfo.rs
@@ -163,13 +163,14 @@ impl<'a> IterInfo<'a> {
}
pub fn ddayset(&self, year: isize, month: usize, day: usize) -> (Vec<usize>, usize, usize) {
- let set = vec![0; self.yearlen().unwrap()];
+ let mut set = vec![0; self.yearlen().unwrap()];
let i = (to_ordinal(
&Utc.ymd(year as i32, month as u32, day as u32)
.and_hms(0, 0, 0),
) - self.yearordinal().unwrap()) as usize;
+ set[i] = i;
(set, i, i + 1)
}
@@ -218,7 +219,7 @@ impl<'a> IterInfo<'a> {
Frequenzy::MONTHLY => self.mdayset(month),
Frequenzy::WEEKLY => self.wdayset(year, month, day),
Frequenzy::DAILY => self.ddayset(year, month, day),
- _ => self.ydayset(),
+ _ => panic!("Invalid freq"),
}
}
@@ -234,7 +235,7 @@ impl<'a> IterInfo<'a> {
Frequenzy::HOURLY => self.htimeset(hour, minute, second, millisecond),
Frequenzy::MINUTELY => self.mtimeset(hour, minute, second, millisecond),
Frequenzy::SECONDLY => self.stimeset(hour, minute, second, millisecond),
- _ => self.htimeset(hour, minute, second, millisecond),
+ _ => panic!("Invalid freq"),
}
}
}