Implement done command
This commit is contained in:
parent
0de89bd424
commit
b476a95afb
6 changed files with 67 additions and 20 deletions
|
|
@ -37,6 +37,30 @@ impl fmt::Display for Dates {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Dates> for DoneDate {
|
||||
fn from(dates: Dates) -> Self {
|
||||
match dates.times {
|
||||
Some(times) if dates.root == dates.other && times.root == times.other => {
|
||||
DoneDate::DateWithTime {
|
||||
root: dates.root,
|
||||
root_time: times.root,
|
||||
}
|
||||
}
|
||||
Some(times) => DoneDate::DateToDateWithTime {
|
||||
root: dates.root,
|
||||
root_time: times.root,
|
||||
other: dates.other,
|
||||
other_time: times.other,
|
||||
},
|
||||
None if dates.root == dates.other => DoneDate::Date { root: dates.root },
|
||||
None => DoneDate::DateToDate {
|
||||
root: dates.root,
|
||||
other: dates.other,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dates {
|
||||
pub fn new(root: NaiveDate, other: NaiveDate) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue