Collect relevant entries based on different modes
This commit is contained in:
parent
b8aeb79323
commit
f42027e378
3 changed files with 122 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use std::fmt;
|
||||
use std::{cmp, fmt};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
|
||||
|
|
@ -372,6 +372,29 @@ impl DoneDate {
|
|||
DoneDate::DateToDateWithTime { root, .. } => *root,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn other(&self) -> Option<NaiveDate> {
|
||||
match self {
|
||||
DoneDate::Date { .. } => None,
|
||||
DoneDate::DateWithTime { .. } => None,
|
||||
DoneDate::DateToDate { other, .. } => Some(*other),
|
||||
DoneDate::DateToDateWithTime { other, .. } => Some(*other),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn first(&self) -> NaiveDate {
|
||||
match self.other() {
|
||||
None => self.root(),
|
||||
Some(other) => cmp::min(self.root(), other),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn last(&self) -> NaiveDate {
|
||||
match self.other() {
|
||||
None => self.root(),
|
||||
Some(other) => cmp::max(self.root(), other),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue