-- |
-- Stability   :  Ultra-Violence
-- Portability :  I'm too young to die
-- XEP-0082: XMPP Date and Time Profiles

module Network.Xmpp.Extras.DateTime where

import Data.Time

toDateTime :: UTCTime -> String
toDateTime :: UTCTime -> String
toDateTime = TimeLocale -> String -> UTCTime -> String
forall t. FormatTime t => TimeLocale -> String -> t -> String
formatTime TimeLocale
defaultTimeLocale String
"%Y-%m-%dT%H:%M:%S%QZ"

fromDateTime :: String -> Maybe UTCTime
fromDateTime :: String -> Maybe UTCTime
fromDateTime = Bool -> TimeLocale -> String -> String -> Maybe UTCTime
forall (m :: * -> *) t.
(MonadFail m, ParseTime t) =>
Bool -> TimeLocale -> String -> String -> m t
parseTimeM Bool
False TimeLocale
defaultTimeLocale String
"%Y-%m-%dT%H:%M:%S%QZ"