module Text.Show.Text.Data.Time (
showbDay
, showbDiffTime
, showbUTCTime
, showbNominalDiffTime
, showbAbsoluteTime
, showbTimeZone
, showbTimeOfDay
, showbLocalTime
) where
import Data.Text.Buildable (build)
import Data.Text.Lazy.Builder (Builder)
import Data.Time.Calendar (Day)
import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime)
import Data.Time.Clock.TAI (AbsoluteTime, taiToUTCTime)
import Data.Time.LocalTime (TimeZone, TimeOfDay, LocalTime,
utc, utcToLocalTime)
import Prelude hiding (Show)
import Text.Show.Text.Class (Show(showb))
import Text.Show.Text.Utils ((<>))
showbDay :: Day -> Builder
showbDay = build
showbDiffTime :: DiffTime -> Builder
showbDiffTime = build
showbUTCTime :: UTCTime -> Builder
showbUTCTime = build
showbNominalDiffTime :: NominalDiffTime -> Builder
showbNominalDiffTime = build
showbAbsoluteTime :: AbsoluteTime -> Builder
showbAbsoluteTime t = showbLocalTime (utcToLocalTime utc $ taiToUTCTime (const 0) t)
<> " TAI"
showbTimeZone :: TimeZone -> Builder
showbTimeZone = build
showbTimeOfDay :: TimeOfDay -> Builder
showbTimeOfDay = build
showbLocalTime :: LocalTime -> Builder
showbLocalTime = build
instance Show Day where
showb = showbDay
instance Show DiffTime where
showb = showbDiffTime
instance Show UTCTime where
showb = showbUTCTime
instance Show NominalDiffTime where
showb = showbNominalDiffTime
instance Show AbsoluteTime where
showb = showbAbsoluteTime
instance Show TimeZone where
showb = showbTimeZone
instance Show TimeOfDay where
showb = showbTimeOfDay
instance Show LocalTime where
showb = showbLocalTime