aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-07-11 09:05:26 -0500
committerGitHub <noreply@github.com>2018-07-11 09:05:26 -0500
commit2a24f054f0f51974ffe08d67052318586716d925 (patch)
tree9bc1664b7c8ecc01b073925e2215095785a8231f /src
parent1ed9b1ddd4b596fc7aa928a372fefe9d7908326a (diff)
parent1e51ec77a0d15d25319636cc589f5930a68a1dee (diff)
downloadmilf-rs-2a24f054f0f51974ffe08d67052318586716d925.tar.gz
milf-rs-2a24f054f0f51974ffe08d67052318586716d925.zip
Merge pull request #251 from ehuss/datetime-space
0.5: Support space separator in datetime.
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 5e63cb4..e033950 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -1019,6 +1019,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()? {