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> {
|
impl<'a> CommandState<'a> {
|
||||||
pub fn eval_birthday_spec(&mut self, spec: &BirthdaySpec) {
|
pub fn eval_birthday_spec(&mut self, spec: &BirthdaySpec) {
|
||||||
// This could be optimized by restricting the range via FROM and UNTIL,
|
let range = match self.limit_from_until(self.range) {
|
||||||
// but I don't think that kind of optimization will be necessary any
|
Some(range) => range,
|
||||||
// time soon.
|
None => return,
|
||||||
for year in self.range.years() {
|
};
|
||||||
|
|
||||||
|
for year in range.years() {
|
||||||
let age = if spec.year_known {
|
let age = if spec.year_known {
|
||||||
let age = year - spec.date.year();
|
let age = year - spec.date.year();
|
||||||
if age < 0 {
|
if age < 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue