1 {-# LANGUAGE FlexibleContexts #-}
2 module Data.Time.RFC1123.Internal
9 import Data.Time.Calendar.WeekDate
10 import Data.Time.HTTP.Common
11 import Data.Time.RFC822.Internal
13 -- |This is a parsec parser for RFC 1123 date and time strings.
14 rfc1123DateAndTime :: Stream s m Char => ParsecT s u m ZonedTime
15 rfc1123DateAndTime = dateTime
17 dateTime :: Stream s m Char => ParsecT s u m ZonedTime
18 dateTime = do weekDay <- optionMaybe $
19 do w <- shortWeekDayNameP
25 -> return () -- No day in week exists.
27 -> assertWeekDayIsGood givenWD gregDay
28 (tod, timeZone) <- rfc822time
29 let lt = LocalTime gregDay tod
30 zt = ZonedTime lt timeZone
33 date :: Stream s m Char => ParsecT s u m Day
34 date = do day <- read2
36 month <- shortMonthNameP
40 assertGregorianDateIsGood year month day