| Copyright | (C) 2017 Jason Johnson |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Jason Johnson <jason.johnson.081@gmail.com> |
| Stability | experimental |
| Portability | POSIX, Windows |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.HodaTime.Pattern.CalendarDate
Contents
Description
Patterns for a CalendarDate: the standard date layouts (pd, pD, pR) together with
the individual field patterns (pyyyy, pMM, pMMMM, pdd, pdddd and friends) from which custom date patterns
are built. The primed variants (pMMMM', pddd' …) take a Locale and use its
month/weekday names.
Synopsis
- pd :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String
- pD :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal), Show (DoW (c cal)), Enum (DoW (c cal)), Bounded (DoW (c cal))) => Pattern (c cal -> c cal) (c cal -> String) String
- pR :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String
- pmonthDay :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String
- pyearMonth :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String
- pyear :: HasDate d => Int -> Pattern (d -> d) (d -> String) String
- pyyyy :: HasDate d => Pattern (d -> d) (d -> String) String
- pyy :: HasDate d => Pattern (d -> d) (d -> String) String
- pmonthNum :: (HasDate d, Enum (MoY d)) => Int -> Pattern (d -> d) (d -> String) String
- pMM :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String
- pMMM :: forall cal d c. (d ~ c cal, MoY d ~ Month cal, IsCalendar cal, HasDate d, Bounded (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (d -> d) (d -> String) String
- pMMMM :: forall cal d c. (d ~ c cal, MoY d ~ Month cal, IsCalendar cal, HasDate d, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (d -> d) (d -> String) String
- pMMM' :: (HasDate d, Enum (MoY d)) => Locale -> Pattern (d -> d) (d -> String) String
- pMMMM' :: (HasDate d, Enum (MoY d)) => Locale -> Pattern (d -> d) (d -> String) String
- pMonthName :: (HasDate d, Enum (MoY d)) => [String] -> Pattern (d -> d) (d -> String) String
- pday :: HasDate d => Int -> Pattern (d -> d) (d -> String) String
- pdd :: HasDate d => Pattern (d -> d) (d -> String) String
- pdaySpace :: HasDate d => Pattern (d -> d) (d -> String) String
- pddd :: forall d. (HasDate d, Show (DoW d), Enum (DoW d), Bounded (DoW d)) => Pattern (d -> d) (d -> String) String
- pdddd :: forall d. (HasDate d, Show (DoW d), Enum (DoW d), Bounded (DoW d)) => Pattern (d -> d) (d -> String) String
- pddd' :: (HasDate d, Enum (DoW d)) => Locale -> Pattern (d -> d) (d -> String) String
- pdddd' :: (HasDate d, Enum (DoW d)) => Locale -> Pattern (d -> d) (d -> String) String
- pDayName :: (HasDate d, Enum (DoW d)) => [String] -> Pattern (d -> d) (d -> String) String
Standard Patterns
pd :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String Source #
This is the short date pattern, currently defined as "ddMMyyyy".
pD :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal), Show (DoW (c cal)), Enum (DoW (c cal)), Bounded (DoW (c cal))) => Pattern (c cal -> c cal) (c cal -> String) String Source #
This is the long date pattern, currently defined as "dddd, dd MMMM yyyy".
pR :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String Source #
The ISO-8601 round-trippable date pattern, "yyyy-MM-dd".
pmonthDay :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String Source #
The month-and-day partial pattern (no year), currently "MMMM dd", e.g. March 03.
pyearMonth :: (HasDate (c cal), MoY (c cal) ~ Month cal, IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String Source #
The year-and-month partial pattern (no day), currently "yyyy MMMM", e.g. 2020 March.
Custom Patterns
Used to create specialized patterns.
pyear :: HasDate d => Int -> Pattern (d -> d) (d -> String) String Source #
Absolute year of at least w digits. Width 1 is the no-padding case (reads 1-4 digits, so both "3" and
"2020" parse; formats with no leading zeros); width n >= 2 reads exactly n digits. The value is always the
literal year and is never truncated, so this is the strict counterpart to pyy (which does two-digit century
inference). Values 0-9999 (note: not all dates will be valid in all calendars, if the date is too early it will
clamp to earliest valid date)
pyyyy :: HasDate d => Pattern (d -> d) (d -> String) String Source #
Absolute year in exactly 4 digits (); values 0000-9999.pyear 4
pyy :: HasDate d => Pattern (d -> d) (d -> String) String Source #
Two-digit year of the era with the century inferred, mirroring Noda Time's yy specifier (contrast with the
strict, absolute pyear). Formatting emits year zero-padded to two digits, so mod 1002020 becomes "20"
and 2005 becomes "05". Parsing reads exactly two digits and expands them to the year with those final two
digits that is closest to the parse template (the default passed to parse, whose year is 2000 for the Gregorian
epoch), breaking ties toward the future. With the default template this maps "20" to 2020 and "99" to
1999; supply a different template via parse' to slide the 100-year window.
pmonthNum :: (HasDate d, Enum (MoY d)) => Int -> Pattern (d -> d) (d -> String) String Source #
Month of year as a number of w digits, zero-padded; a width of 1 means no padding. Values 1-12.
pMM :: (HasDate d, Enum (MoY d)) => Pattern (d -> d) (d -> String) String Source #
Month of year as a zero-padded number (); values 01-12.pmonthNum 2
pMMM :: forall cal d c. (d ~ c cal, MoY d ~ Month cal, IsCalendar cal, HasDate d, Bounded (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (d -> d) (d -> String) String Source #
Abbreviated month name (e.g. Jan), parsed case-insensitively and formatted in title case.
NOTE: the abbreviation is simply the first three letters of the month name, so in calendars where two months share
a three-letter prefix (e.g. the Hebrew AdarI and Adar) parsing is ambiguous and resolves to the first match in
month order. Use pMMMM (full name) or pMM (number) when you need an unambiguous round-trip.
pMMMM :: forall cal d c. (d ~ c cal, MoY d ~ Month cal, IsCalendar cal, HasDate d, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (d -> d) (d -> String) String Source #
Full month name, parsed case-insensitively. Formats in title case
pMonthName :: (HasDate d, Enum (MoY d)) => [String] -> Pattern (d -> d) (d -> String) String Source #
Format and parse the month using an explicit list of names (index 0 is the calendar's first month), instead of the
calendar's built-in English constructor names. This is the calendar-agnostic core behind the locale-aware pMMMM'
and pMMM'; pass monthNames (or monthNamesShort) for OS locale names, or any list of the
right length for a custom calendar. Parsing is case-insensitive and, like pMMMM, tries the names in order.
pday :: HasDate d => Int -> Pattern (d -> d) (d -> String) String Source #
Day of month of w digits, zero-padded; a width of 1 means no padding. Values 1-31.
pdd :: HasDate d => Pattern (d -> d) (d -> String) String Source #
Day of month, zero-padded (); values 01-31.pday 2
pdaySpace :: HasDate d => Pattern (d -> d) (d -> String) String Source #
Day of month, space-padded to two characters (the strftime %e convention), e.g. " 3" or "15". On
parse it also accepts the bare and zero-padded forms.
pddd :: forall d. (HasDate d, Show (DoW d), Enum (DoW d), Bounded (DoW d)) => Pattern (d -> d) (d -> String) String Source #
Abbreviated day of week name (e.g. Mon), parsed case-insensitively and formatted in title case. Note: on parse
this only consumes the weekday, it is not validated against the day/month/year (which fully determine the date).
pdddd :: forall d. (HasDate d, Show (DoW d), Enum (DoW d), Bounded (DoW d)) => Pattern (d -> d) (d -> String) String Source #
Full day of week name (e.g. Monday), parsed case-insensitively and formatted in title case. Note: on parse this
only consumes the weekday, it is not validated against the day/month/year (which fully determine the date).
pDayName :: (HasDate d, Enum (DoW d)) => [String] -> Pattern (d -> d) (d -> String) String Source #
Format and parse the day-of-week using an explicit list of names (index 0 = Sunday), instead of the calendar's
built-in English constructor names. This is the calendar-agnostic core behind pdddd' / pddd'. As with
pdddd, parsing only consumes the weekday; it is not validated against the day/month/year.