mirror of
https://github.com/bspeice/dtparse
synced 2024-12-22 04:18:09 -05:00
One last test case, then version 0.9!
This commit is contained in:
parent
9008ee8339
commit
5152ced2f1
@ -196,7 +196,9 @@ impl ParserInfo {
|
|||||||
|
|
||||||
fn get_ampm(&self, name: &str) -> Option<bool> {
|
fn get_ampm(&self, name: &str) -> Option<bool> {
|
||||||
if let Some(v) = self.ampm.get(&name.to_lowercase()) {
|
if let Some(v) = self.ampm.get(&name.to_lowercase()) {
|
||||||
Some(v.to_owned() == 1)
|
// Python technically uses numbers here, but given that the numbers are
|
||||||
|
// only 0 and 1, it's easier to use booleans
|
||||||
|
Some(*v == 1)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@ -639,7 +641,7 @@ impl Parser {
|
|||||||
let is_ampm = self.ampm_valid(res.hour, res.ampm, fuzzy);
|
let is_ampm = self.ampm_valid(res.hour, res.ampm, fuzzy);
|
||||||
|
|
||||||
if is_ampm.is_ok() {
|
if is_ampm.is_ok() {
|
||||||
res.hour = Some(self.adjust_ampm(res.hour.unwrap(), value));
|
res.hour = res.hour.map(|h| self.adjust_ampm(h, value));
|
||||||
res.ampm = Some(value);
|
res.ampm = Some(value);
|
||||||
} else if fuzzy {
|
} else if fuzzy {
|
||||||
skipped_idxs.push(i);
|
skipped_idxs.push(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user