From 20d78ed504961540820fa78f82aec10cd935d60d Mon Sep 17 00:00:00 2001 From: Fredrik Meringdal Date: Thu, 15 Oct 2020 01:15:17 +0200 Subject: daily also works!!! --- src/iterinfo.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/iterinfo.rs') 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) { - 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"), } } } -- cgit v1.2.3