Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(crate) use day_of_week::DayOfWeek;
pub(crate) use month::Month;
use year::Year;

use crate::interrupt::test_int;
use crate::{Interrupt, error::FendError, ident::Ident, result::FResult, value::Value};

#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -203,6 +204,7 @@ impl Date {
let num_days = rhs.try_as_usize_unit(int)?;
let mut result = self;
for _ in 0..num_days {
test_int(int)?;
result = result.next();
}
Ok(Value::Date(result))
Expand All @@ -219,6 +221,7 @@ impl Date {
let mut result = self;
for _ in 0..num_days {
result = result.prev();
test_int(int)?;
}
Ok(Value::Date(result))
} else if rhs.unit_equal_to("week", int)? {
Expand All @@ -228,6 +231,7 @@ impl Date {
for _ in 0..7 {
result = result.prev();
}
test_int(int)?;
}
Ok(Value::Date(result))
} else if rhs.unit_equal_to("month", int)? {
Expand Down
Loading