aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2018-07-10 17:14:16 -0700
committerEric Huss <eric@huss.org>2018-07-10 17:14:16 -0700
commit1e51ec77a0d15d25319636cc589f5930a68a1dee (patch)
tree82dcab23f07b34f8cdc957ac5fdf9073e11566ee /src
parent2be7ce9079fa02d9dd42958410ba1c40cef9811c (diff)
downloadmilf-rs-1e51ec77a0d15d25319636cc589f5930a68a1dee.tar.gz
milf-rs-1e51ec77a0d15d25319636cc589f5930a68a1dee.zip
0.5: Support space separate in datetime.
cc #224
Diffstat (limited to 'src')
-rw-r--r--src/datetime.rs3
-rw-r--r--src/de.rs11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/datetime.rs b/src/datetime.rs
index c67e2c4..3678f58 100644
--- a/src/datetime.rs
+++ b/src/datetime.rs
@@ -176,7 +176,8 @@ impl FromStr for Datetime {
// Next parse the "partial-time" if available
let partial_time = if full_date.is_some() &&
- chars.clone().next() == Some('T') {
+ (chars.clone().next() == Some('T')
+ || chars.clone().next() == Some(' ')) {
chars.next();
true
} else {
diff --git a/src/de.rs b/src/de.rs
index 1d43cc9..c2679f5 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -1010,6 +1010,17 @@ impl<'a> Deserializer<'a> {
-> Result<(Span, &'a str), Error> {
let start = self.tokens.substr_offset(date);
+ // Check for space separated date and time.
+ if let Some((_, Token::Whitespace(s))) = self.peek()? {
+ if s == " " {
+ self.next()?;
+ // Skip past the hour.
+ if let Some((_, Token::Keylike(_))) = self.peek()? {
+ self.next()?;
+ }
+ }
+ }
+
if colon_eaten || self.eat(Token::Colon)? {
// minutes
match self.next()? {