Data.Time.Calendar.OrdinalDate.Compat

time-compat-1.9.8: Compatibility package for time

Safe Haskell | Trustworthy
Language | Haskell2010

Data.Time.Calendar.OrdinalDate.Compat

Synopsis

- data Day
- type Year = Integer
- type DayOfYear = Int
- type WeekOfYear = Int
- toOrdinalDate :: Day -> (Year, DayOfYear)
- fromOrdinalDate :: Year -> DayOfYear -> Day
- pattern YearDay :: Year -> DayOfYear -> Day
- fromOrdinalDateValid :: Year -> DayOfYear -> Maybe Day
- showOrdinalDate :: Day -> String
- isLeapYear :: Year -> Bool
- mondayStartWeek :: Day -> (WeekOfYear, Int)
- sundayStartWeek :: Day -> (WeekOfYear, Int)
- fromMondayStartWeek :: Year -> WeekOfYear -> Int -> Day
- fromMondayStartWeekValid :: Year -> WeekOfYear -> Int -> Maybe Day
- fromSundayStartWeek :: Year -> WeekOfYear -> Int -> Day
- fromSundayStartWeekValid :: Year -> WeekOfYear -> Int -> Maybe Day

# Documentation

data Day #

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

#### Instances

Instances details

NFData Day |
Instance details Defined in Data.Time.Calendar.Days Methods rnf :: Day -> () #
Data Day |
Instance details Defined in Data.Time.Calendar.Days Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Day -> c Day # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day # toConstr :: Day -> Constr # dataTypeOf :: Day -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day) # gmapT :: (forall b. Data b => b -> b) -> Day -> Day # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r # gmapQ :: (forall d. Data d => d -> u) -> Day -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day #
Enum Day |
Instance details Defined in Data.Time.Calendar.Days Methods succ :: Day -> Day # pred :: Day -> Day # toEnum :: Int -> Day # fromEnum :: Day -> Int # enumFrom :: Day -> [Day] # enumFromThen :: Day -> Day -> [Day] # enumFromTo :: Day -> Day -> [Day] # enumFromThenTo :: Day -> Day -> Day -> [Day] #
Generic Day # |
Instance details Defined in Data.Time.Orphans Associated Types
type Rep Day |
Instance details Defined in Data.Time.Orphans type Rep Day = D1 ('MetaData "Day" "Data.Time.Calendar.Days" "time-1.12.2-inplace" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))
Methods from :: Day -> Rep Day x # to :: Rep Day x -> Day #
Ix Day |
Instance details Defined in Data.Time.Calendar.Days Methods range :: (Day, Day) -> [Day] # index :: (Day, Day) -> Day -> Int # unsafeIndex :: (Day, Day) -> Day -> Int # inRange :: (Day, Day) -> Day -> Bool # rangeSize :: (Day, Day) -> Int # unsafeRangeSize :: (Day, Day) -> Int #
Eq Day |
Instance details Defined in Data.Time.Calendar.Days Methods (==) :: Day -> Day -> Bool # (/=) :: Day -> Day -> Bool #
Ord Day |
Instance details Defined in Data.Time.Calendar.Days Methods compare :: Day -> Day -> Ordering # (<) :: Day -> Day -> Bool # (<=) :: Day -> Day -> Bool # (>) :: Day -> Day -> Bool # (>=) :: Day -> Day -> Bool # max :: Day -> Day -> Day # min :: Day -> Day -> Day #
Hashable Day # |
Instance details Defined in Data.Time.Orphans Methods hashWithSalt :: Int -> Day -> Int # hash :: Day -> Int #
DayPeriod Day |
Instance details Defined in Data.Time.Calendar.Days Methods periodFirstDay :: Day -> Day # periodLastDay :: Day -> Day # dayPeriod :: Day -> Day #
ISO8601 Day | `yyyy-mm-dd` (ISO 8601:2004(E) sec. 4.1.2.2 extended format)
Instance details Defined in Data.Time.Format.ISO8601 Methods iso8601Format :: Format Day #
Lift Day # |
Instance details Defined in Data.Time.Orphans Methods lift :: Quote m => Day -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Day -> Code m Day #
type Rep Day # |
Instance details Defined in Data.Time.Orphans type Rep Day = D1 ('MetaData "Day" "Data.Time.Calendar.Days" "time-1.12.2-inplace" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

type Year = Integer #

Year of Common Era (when positive).

type DayOfYear = Int #

Day of year, in range 1 (January 1st) to 366. December 31st is 365 in a common year, 366 in a leap year.

type WeekOfYear = Int #

Week of year, by various reckonings, generally in range 0-53 depending on reckoning.

toOrdinalDate :: Day -> (Year, DayOfYear) #

Convert to ISO 8601 Ordinal Date format.

fromOrdinalDate :: Year -> DayOfYear -> Day #

Convert from ISO 8601 Ordinal Date format. Invalid day numbers will be clipped to the correct range (1 to 365 or 366).

pattern YearDay :: Year -> DayOfYear -> Day #

Bidirectional abstract constructor for ISO 8601 Ordinal Date format. Invalid day numbers will be clipped to the correct range (1 to 365 or 366).

fromOrdinalDateValid :: Year -> DayOfYear -> Maybe Day #

Convert from ISO 8601 Ordinal Date format. Invalid day numbers return `Nothing`

showOrdinalDate :: Day -> String #

Show in ISO 8601 Ordinal Date format (yyyy-ddd)

isLeapYear :: Year -> Bool #

Is this year a leap year according to the proleptic Gregorian calendar?

mondayStartWeek :: Day -> (WeekOfYear, Int) #

Get the number of the Monday-starting week in the year and the day of the week. The first Monday is the first day of week 1, any earlier days in the year are week 0 (as `%W` in `formatTime`). Monday is 1, Sunday is 7 (as `%u` in `formatTime`).

sundayStartWeek :: Day -> (WeekOfYear, Int) #

Get the number of the Sunday-starting week in the year and the day of the week. The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as `%U` in `formatTime`). Sunday is 0, Saturday is 6 (as `%w` in `formatTime`).

fromMondayStartWeek #

Arguments

:: Year | Year.
-> WeekOfYear | Monday-starting week number (as `%W` in `formatTime`).
-> Int | Day of week. Monday is 1, Sunday is 7 (as `%u` in `formatTime`).
-> Day |

The inverse of `mondayStartWeek`. Get a `Day` given the year, the number of the Monday-starting week, and the day of the week. The first Monday is the first day of week 1, any earlier days in the year are week 0 (as `%W` in `formatTime`).

fromMondayStartWeekValid #

Arguments

:: Year | Year.
-> WeekOfYear | Monday-starting week number (as `%W` in `formatTime`).
-> Int | Day of week. Monday is 1, Sunday is 7 (as `%u` in `formatTime`).
-> Maybe Day |

fromSundayStartWeek #

Arguments

:: Year | Year.
-> WeekOfYear | Sunday-starting week number (as `%U` in `formatTime`).
-> Int | Day of week Sunday is 0, Saturday is 6 (as `%w` in `formatTime`).
-> Day |

The inverse of `sundayStartWeek`. Get a `Day` given the year and the number of the day of a Sunday-starting week. The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as `%U` in `formatTime`).

fromSundayStartWeekValid #

Arguments

:: Year | Year.
-> WeekOfYear | Sunday-starting week number (as `%U` in `formatTime`).
-> Int | Day of week. Sunday is 0, Saturday is 6 (as `%w` in `formatTime`).
-> Maybe Day |