Skip to content

Commit 030f51e

Browse files
ondraptmcgilchrist
authored andcommitted
':' is optional in parsing ISO format (not strictly ISO though)
1 parent 49948de commit 030f51e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Data/Thyme/Format/DateFast.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Data.Thyme.Format.DateFast (
1111
import Control.Applicative
1212
#endif
1313
import Control.Lens (from, view)
14-
import Control.Monad (unless, void)
14+
import Control.Monad (unless, when, void)
1515
import qualified Data.ByteString as BS
1616
import Data.Int (Int64)
1717
import Data.List (foldl1')
@@ -71,7 +71,9 @@ parseNumber4 = do -- Specialized version for 2 digits
7171
toffset :: Scanner Int64
7272
toffset = do
7373
hours <- parseNumber2
74-
S.char8 ':'
74+
-- optional ':'
75+
colon <- S.lookAheadChar8
76+
when (colon == Just ':') (S.char8 ':')
7577
minutes <- parseNumber2
7678
return $ fromIntegral $ hours * 3600 + minutes * 60
7779
{-# INLINE toffset #-}

thyme.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ library
105105
vector-th-unbox >= 0.2.1.0,
106106
vector-space >= 0.8,
107107
scanner
108+
build-tools: hsc2hs
108109
if os(windows)
109110
build-depends: Win32
110111
if os(darwin) || os(freebsd)

0 commit comments

Comments
 (0)