Merge pull request #275 from ehuss/fix-datetime-trailing-space
Fix trailing space after date.
This commit is contained in:
commit
c1c0cb2d1b
13
src/de.rs
13
src/de.rs
|
@ -1035,13 +1035,12 @@ impl<'a> Deserializer<'a> {
|
||||||
let start = self.tokens.substr_offset(date);
|
let start = self.tokens.substr_offset(date);
|
||||||
|
|
||||||
// Check for space separated date and time.
|
// Check for space separated date and time.
|
||||||
if let Some((_, Token::Whitespace(s))) = self.peek()? {
|
let mut lookahead = self.tokens.clone();
|
||||||
if s == " " {
|
if let Ok(Some((_, Token::Whitespace(" ")))) = lookahead.next() {
|
||||||
self.next()?;
|
// Check if hour follows.
|
||||||
// Skip past the hour.
|
if let Ok(Some((_, Token::Keylike(_)))) = lookahead.next() {
|
||||||
if let Some((_, Token::Keylike(_))) = self.peek()? {
|
self.next()?; // skip space
|
||||||
self.next()?;
|
self.next()?; // skip keylike hour
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ fn times() {
|
||||||
good("1997-09-09T09:09:09-09:09");
|
good("1997-09-09T09:09:09-09:09");
|
||||||
good("1997-09-09T09:09:09");
|
good("1997-09-09T09:09:09");
|
||||||
good("1997-09-09");
|
good("1997-09-09");
|
||||||
|
dogood("1997-09-09 ", "1997-09-09");
|
||||||
|
dogood("1997-09-09 # comment", "1997-09-09");
|
||||||
good("09:09:09");
|
good("09:09:09");
|
||||||
good("1997-09-09T09:09:09.09Z");
|
good("1997-09-09T09:09:09.09Z");
|
||||||
good("1997-09-09T09:09:09.09+09:09");
|
good("1997-09-09T09:09:09.09+09:09");
|
||||||
|
|
Loading…
Reference in a new issue