packages feed

holidays 0.4.0.0 → 0.4.0.1

raw patch · 8 files changed

+35/−13 lines, 8 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -22,3 +22,6 @@  ## **0.4.0.0** - 2026-06-04 - use ADT's for country codes and regions++## **0.4.0.1** - 2026-09-13+- local election holiday for South Africa
holidays.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: holidays-version: 0.4.0.0+version: 0.4.0.1 synopsis: Library for country public holidays description:   Public holidays with Haskell.
src/Holidays.hs view
@@ -35,8 +35,13 @@   | ZAF   deriving (Show) --- | Constructor for country code.-mkCountryCode :: T.Text -> [T.Text] -> Maybe ISO_3166_1_Alpha_3+-- | Constructor for a country code.+mkCountryCode ::+  -- | The country code in text.+  T.Text ->+  -- | Region codes in text.+  [T.Text] ->+  Maybe ISO_3166_1_Alpha_3 mkCountryCode t regions =   case t of     "DEU" -> Just (DEU (Germany.mkGermanRegions regions))@@ -46,7 +51,7 @@     "NAM" -> Just NAM     "USA" -> Just USA     "ZAF" -> Just ZAF-    _ -> Nothing+    _     -> Nothing  {- | Returns a set of public holidays based on the country code (ISO_3166_1_Alpha_3) and a specific year.@@ -56,7 +61,7 @@ Examples:  @-holidays DEU (S.fromList [BW, BY ,BE]) 2025 -- Germany and various regions+holidays (DEU (S.fromList [BW, BY, BE])) 2025 -- Germany and various regions holidays USA 2025 @ -}
src/Holidays/Base.hs view
@@ -11,7 +11,7 @@  data Holiday   = Holiday-  { holidayKey :: T.Text,+  { holidayKey   :: T.Text,     holidayValue :: Day   }   deriving (Ord, Eq, Show)
src/Holidays/Germany.hs view
@@ -66,7 +66,7 @@     "ST" -> Just ST     "SH" -> Just SH     "TH" -> Just TH-    _ -> Nothing+    _    -> Nothing  holidays :: S.Set GermanRegion -> ([Year -> Holiday], [DateTransform]) holidays regions =
src/Holidays/Israel.hs view
@@ -8,15 +8,11 @@ ) where  import qualified Data.Set as S---- import Data.Text (show) import qualified Data.Text as T import Data.Time import qualified Data.Time.Calendar.Hebrew as H  import Holidays.Base---- import Holidays.DateFinder import Holidays.DateTransform  holidays :: ([Year -> Holiday], [DateTransform])@@ -39,7 +35,7 @@ jewishHoliday :: H.Month -> Int -> Year -> Day jewishHoliday m d y =   case ds' of-    [] -> nullDay+    []       -> nullDay     (d' : _) -> d'   where     ds = map (\hy -> H.fromHebrew (H.HebrewDate (H.year hy) m d)) (hebrewDates y)@@ -52,5 +48,6 @@ hebrewDates :: Year -> [H.HebrewDate] hebrewDates y = map (\x -> H.toHebrew (fromGregorian (y + x) January 1)) [-1, 0, 1] +-- | Get all sabbaths for a year. Essentially when day is a Saturday. sabbaths :: Year -> S.Set Holiday sabbaths = S.fromList . map (\(i, d) -> hday ("sabbath_" <> (T.show i)) d) . zip [1 :: Int ..] . filter (\d -> dayOfWeek d == Saturday) . periodAllDays
src/Holidays/SouthAfrica.hs view
@@ -25,7 +25,8 @@       hday "christmas_day" . christmasDay,       hday "day_of_goodwill" . boxingDay,       -- special days-      hday "general_elections_2024" . years (== 2024) . may 29+      hday "general_elections_2024" . years (== 2024) . may 29,+      hday "local_elections_2026" . years (== 2026) . nov 4     ],     [sundayRule]   )
tst/Test/Holidays/SouthAfrica.hs view
@@ -44,6 +44,22 @@                 hday "day_of_reconciliation" (day 2025 12 16),                 hday "christmas_day" (day 2025 12 25),                 hday "day_of_goodwill" (day 2025 12 26)+              ],+      testCase "2026" $+        sortOn holidayValue (S.toList (holidays ZAF 2026))+          @?= [ hday "new_years_day" (day 2026 1 1),+                hday "human_rights_day" (day 2026 3 21),+                hday "good_friday" (day 2026 4 3),+                hday "family_day" (day 2026 4 6),+                hday "freedom_day" (day 2026 4 27),+                hday "workers_day" (day 2026 5 1),+                hday "youth_day" (day 2026 6 16),+                hday "womens_day" (day 2026 8 10),+                hday "heritage_day" (day 2026 9 24),+                hday "local_elections_2026" (day 2026 11 4),+                hday "day_of_reconciliation" (day 2026 12 16),+                hday "christmas_day" (day 2026 12 25),+                hday "day_of_goodwill" (day 2026 12 26)               ]     ]