summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMagnus Holm <judofyr@gmail.com>2015-07-24 18:08:05 +0200
committerMagnus Holm <judofyr@gmail.com>2015-07-24 18:08:05 +0200
commitfdf454e3ae4ec9e0d0a597c8f28658b9ce99e41a (patch)
tree3f41f9a887cbcb9203ee3907b75e438d610876d3
parent49324157421d138c3cba39b629bdb88a5b88dc54 (diff)
downloadNim-fdf454e3ae4ec9e0d0a597c8f28658b9ce99e41a.tar.gz
Fix times' parse with literal strings
-rw-r--r--lib/pure/times.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim
index e4d3f7494..fd5eb7ba4 100644
--- a/lib/pure/times.nim
+++ b/lib/pure/times.nim
@@ -1020,10 +1020,10 @@ proc parse*(value, layout: string): TimeInfo =
       # These are literals in both the layout and the value string
       if layout[i] == '\'':
         inc(i)
-        inc(j)
         while layout[i] != '\'' and layout.len-1 > i:
           inc(i)
           inc(j)
+        inc(i)
       else:
         inc(i)
         inc(j)
@@ -1112,6 +1112,8 @@ when isMainModule:
   s = "2006-01-12T15:04:05Z-07:00"
   f = "yyyy-MM-ddTHH:mm:ssZzzz"
   assert($s.parse(f) == "Thu Jan 12 15:04:05 2006")
+  f = "yyyy-MM-dd'T'HH:mm:ss'Z'zzz"
+  assert($s.parse(f) == "Thu Jan 12 15:04:05 2006")
   # RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"
   s = "2006-01-12T15:04:05.999999999Z-07:00"
   f = "yyyy-MM-ddTHH:mm:ss.999999999Zzzz"