Unify Dates logic and expand DoneDate format

This commit is contained in:
Joscha 2021-12-14 23:32:04 +01:00
parent 2e7ab3c4a1
commit c69af9bcde
8 changed files with 119 additions and 133 deletions

View file

@ -652,7 +652,7 @@ fn parse_donedate(p: Pair<'_, Rule>) -> Result<DoneDate> {
root: parse_datum(ps.pop().unwrap())?.value,
},
2 => match ps[1].as_rule() {
Rule::time => DoneDate::DateWithTime {
Rule::time => DoneDate::DateTime {
root_time: parse_time(ps.pop().unwrap())?.value,
root: parse_datum(ps.pop().unwrap())?.value,
},
@ -662,7 +662,12 @@ fn parse_donedate(p: Pair<'_, Rule>) -> Result<DoneDate> {
},
_ => unreachable!(),
},
4 => DoneDate::DateToDateWithTime {
3 => DoneDate::DateTimeToTime {
other_time: parse_time(ps.pop().unwrap())?.value,
root_time: parse_time(ps.pop().unwrap())?.value,
root: parse_datum(ps.pop().unwrap())?.value,
},
4 => DoneDate::DateTimeToDateTime {
other_time: parse_time(ps.pop().unwrap())?.value,
other: parse_datum(ps.pop().unwrap())?.value,
root_time: parse_time(ps.pop().unwrap())?.value,