|
|
|
@ -1,13 +1,15 @@
@@ -1,13 +1,15 @@
|
|
|
|
|
//! Scheduling for events to run at certain intervals in the future
|
|
|
|
|
|
|
|
|
|
use chrono::{ |
|
|
|
|
Date, DateTime, Datelike, Duration as CDuration, Local, NaiveDateTime, NaiveTime, TimeZone, |
|
|
|
|
Date, DateTime, Datelike, Local, NaiveDateTime, NaiveTime, TimeZone, |
|
|
|
|
Weekday, |
|
|
|
|
}; |
|
|
|
|
use serde::{Deserialize, Serialize}; |
|
|
|
|
use std::cmp; |
|
|
|
|
use std::iter::FromIterator; |
|
|
|
|
|
|
|
|
|
pub use chrono::Duration; |
|
|
|
|
|
|
|
|
|
/// A set of times of day (for [Schedule](struct.Schedule.html))
|
|
|
|
|
pub type TimeSet = Vec<NaiveTime>; |
|
|
|
|
/// A set of days of week (for [Schedule](struct.Schedule.html))
|
|
|
|
@ -380,7 +382,7 @@ impl Schedule {
@@ -380,7 +382,7 @@ impl Schedule {
|
|
|
|
|
.and_time(*time) |
|
|
|
|
.map(|date| { |
|
|
|
|
if date < reference { |
|
|
|
|
date + CDuration::weeks(1) |
|
|
|
|
date + Duration::weeks(1) |
|
|
|
|
} else { |
|
|
|
|
date |
|
|
|
|
} |
|
|
|
|