4 -- |This module provides functions to parse and format RFC 1123 date
7 -- The format is basically same as RFC 822, but the syntax for @date@
15 module Data.Time.RFC1123
25 import Data.Ascii (Ascii)
26 import qualified Data.Ascii as A
27 import qualified Data.Attoparsec.Char8 as P
29 import Data.Time.RFC1123.Internal
30 import Prelude.Unicode
32 -- |Convert a 'ZonedTime' to RFC 1123 date and time string.
33 toAscii ∷ ZonedTime → Ascii
34 toAscii = A.fromAsciiBuilder ∘ toAsciiBuilder
36 -- |Parse an RFC 1123 date and time string. When the string can't be
37 -- parsed, it returns @'Left' err@.
38 fromAscii ∷ Ascii → Either String ZonedTime
39 fromAscii = P.parseOnly p ∘ A.toByteString
41 p = do zt ← rfc1123DateAndTime