{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Hcompta.Model.Date where import Data.Data import qualified Data.Time.LocalTime as Time (ZonedTime(..), utc, utcToZonedTime, zonedTimeToUTC) import qualified Data.Time.Calendar as Time (Day) import qualified Data.Time.Format as Time () import qualified Data.Time.Clock.POSIX as Time (posixSecondsToUTCTime) import qualified Data.Time.Clock as Time (UTCTime) import Data.Typeable () -- * The 'Date' type type Date = Time.ZonedTime deriving instance Eq Date nil :: Date nil = Time.utcToZonedTime Time.utc $ Time.posixSecondsToUTCTime 0 data Interval = Interval_None | Interval_Days Int | Interval_Weeks Int | Interval_Months Int | Interval_Quarters Int | Interval_Years Int | Interval_DayOfMonth Int | Interval_DayOfWeek Int -- Interval_WeekOfYear Int -- Interval_MonthOfYear Int -- Interval_QuarterOfYear Int deriving (Data, Eq, Ord, Read, Show, Typeable) type Smart = (String, String, String) data Span = Span (Maybe Time.Day) (Maybe Time.Day) deriving (Data, Eq, Ord, Read, Show, Typeable) data Which = Which_Primary | Which_Secondary deriving (Eq, Read, Show) type Year = Integer -- * The 'UTC' type type UTC = Time.UTCTime to_UTC :: Date -> UTC to_UTC = Time.zonedTimeToUTC