Skip to content

Commit dfa9f1c

Browse files
author
Devdutt Shenoi
committed
feat: TimeRange::contains to check presence
1 parent 86d236b commit dfa9f1c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/time.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ impl TimeRange {
280280

281281
Self { start, end }
282282
}
283+
284+
/// Returns true if the provided timestamp is within the timerange
285+
pub fn contains(&self, time: DateTime<Utc>) -> bool {
286+
self.start <= time && self.end > time
287+
}
283288
}
284289

285290
/// Represents a minute value (0-59) and provides methods for converting it to a slot range.

0 commit comments

Comments
 (0)