Limit birthday range with FROM and UNTIL
This commit is contained in:
parent
5610f13683
commit
c391d76690
1 changed files with 6 additions and 4 deletions
|
|
@ -8,10 +8,12 @@ use super::super::EntryKind;
|
|||
|
||||
impl<'a> CommandState<'a> {
|
||||
pub fn eval_birthday_spec(&mut self, spec: &BirthdaySpec) {
|
||||
// This could be optimized by restricting the range via FROM and UNTIL,
|
||||
// but I don't think that kind of optimization will be necessary any
|
||||
// time soon.
|
||||
for year in self.range.years() {
|
||||
let range = match self.limit_from_until(self.range) {
|
||||
Some(range) => range,
|
||||
None => return,
|
||||
};
|
||||
|
||||
for year in range.years() {
|
||||
let age = if spec.year_known {
|
||||
let age = year - spec.date.year();
|
||||
if age < 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue