Compare start/end time.

This commit is contained in:
Tom Alexander
2023-10-02 16:37:23 -04:00
parent 9846cde2f0
commit 890cd3e4fd
3 changed files with 94 additions and 13 deletions

View File

@@ -189,6 +189,8 @@ pub struct Timestamp<'s> {
pub range_type: TimestampRangeType,
pub start: Option<Date<'s>>,
pub end: Option<Date<'s>>,
pub start_time: Option<Time<'s>>,
pub end_time: Option<Time<'s>>,
}
#[derive(Debug, PartialEq)]
@@ -273,7 +275,7 @@ impl Hour {
// TODO: Make a real error type instead of a boxed any error.
pub fn new<'s>(source: &'s str) -> Result<Self, Box<dyn std::error::Error>> {
let hour = source.parse::<HourInner>()?;
if hour < 1 || hour > 23 {
if hour > 23 {
Err("Hour exceeds possible range.")?;
}
Ok(Hour(hour))
@@ -288,7 +290,7 @@ impl Minute {
// TODO: Make a real error type instead of a boxed any error.
pub fn new<'s>(source: &'s str) -> Result<Self, Box<dyn std::error::Error>> {
let minute = source.parse::<MinuteInner>()?;
if minute < 1 || minute > 59 {
if minute > 59 {
Err("Minute exceeds possible range.")?;
}
Ok(Minute(minute))