1
0
mirror of https://github.com/bspeice/dtparse synced 2024-12-22 12:28:08 -05:00

It's working!

Still need to add more tests, but I think we're mostly good to go
This commit is contained in:
Bradlee Speice 2018-07-08 15:11:29 -04:00
parent e049618fff
commit c954a533c3

View File

@ -953,9 +953,12 @@ impl Parser {
let hour = value.to_i64().unwrap() as i32; let hour = value.to_i64().unwrap() as i32;
let ampm = info.get_ampm(&tokens[idx + 2]).unwrap(); let ampm = info.get_ampm(&tokens[idx + 2]).unwrap();
res.hour = Some(self.adjust_ampm(hour, ampm)); res.hour = Some(self.adjust_ampm(hour, ampm));
idx += 1;
} else { } else {
ymd.append(value.floor().to_i64().unwrap() as i32, &value_repr, None)?; ymd.append(value.floor().to_i64().unwrap() as i32, &value_repr, None)?;
} }
idx += 1;
} else if info.get_ampm(&tokens[idx + 1]).is_some() } else if info.get_ampm(&tokens[idx + 1]).is_some()
&& (*ZERO <= value && value < *TWENTY_FOUR) && (*ZERO <= value && value < *TWENTY_FOUR)
{ {
@ -1098,6 +1101,7 @@ impl Parser {
fn recombine_skipped(&self, skipped_idxs: Vec<usize>, tokens: Vec<String>) -> Vec<String> { fn recombine_skipped(&self, skipped_idxs: Vec<usize>, tokens: Vec<String>) -> Vec<String> {
let mut skipped_tokens: Vec<String> = vec![]; let mut skipped_tokens: Vec<String> = vec![];
println!("idxs: {:?}, tokens: {:?}", skipped_idxs, tokens);
let mut sorted_idxs = skipped_idxs.clone(); let mut sorted_idxs = skipped_idxs.clone();
sorted_idxs.sort(); sorted_idxs.sort();