From 909d0320a0dba68e33da90e569b22e459a8de4ae Mon Sep 17 00:00:00 2001 From: Alex Selesse Date: Thu, 13 Jan 2022 17:45:10 -0500 Subject: [PATCH 01/11] Add Toronto Stock Exchange (TSX) definitions --- index.yaml | 1 + tsx.yaml | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 tsx.yaml diff --git a/index.yaml b/index.yaml index 1727c9a..1e5cbbe 100644 --- a/index.yaml +++ b/index.yaml @@ -59,6 +59,7 @@ defs: SE: ['se.yaml'] TN: ['tn.yaml'] TR: ['tr.yaml'] + TSX: ['tsx.yaml'] UA: ['ua.yaml'] US: ['us.yaml', 'northamericainformal.yaml'] UnitedNations: ['unitednations.yaml'] diff --git a/tsx.yaml b/tsx.yaml new file mode 100644 index 0000000..ea98d6a --- /dev/null +++ b/tsx.yaml @@ -0,0 +1,257 @@ +# Toronto Stock Exchange (TSX)'s holiday definitions for the Ruby Holiday gem. +# +# Source: https://www.tsx.com/trading/calendars-and-trading-hours/calendar +--- +months: + 0: + - name: Good Friday + regions: [tsx] + function: easter(year) + function_modifier: -2 + 1: + - name: New Year's Day + regions: [tsx] + mday: 1 + observed: to_monday_if_weekend(date) + 2: + - name: Family Day + regions: [tsx] + wday: 1 + week: 3 + year_ranges: + from: 2008 + 5: + - name: Victoria Day + regions: [tsx] + function: ca_victoria_day(year) + 7: + - name: Canada Day + regions: [tsx] + mday: 1 + observed: to_monday_if_weekend(date) + 8: + - name: Civic Holiday + week: 1 + regions: [tsx] + wday: 1 + 9: + - name: Labour Day + week: 1 + regions: [tsx] + wday: 1 + 10: + - name: Thanksgiving + week: 2 + regions: [tsx] + wday: 1 + 12: + - name: Christmas Day + regions: [tsx] + mday: 25 + year_ranges: + until: 2020 + observed: to_weekday_if_weekend(date) + - name: Christmas Day + regions: [tsx] + mday: 25 + observed: to_monday_if_weekend(date) + year_ranges: + from: 2020 + - name: Boxing Day + regions: [tsx] + mday: 26 + year_ranges: + until: 2020 + observed: to_monday_if_weekend(date) + - name: Boxing Day + regions: [tsx] + mday: 26 + year_ranges: + from: 2020 + observed: to_weekday_if_boxing_weekend(date) + +methods: + ca_victoria_day: + # Monday on or before May 24 + arguments: year + ruby: | + date = Date.civil(year,5,24) + if date.wday > 1 + date -= (date.wday - 1) + elsif date.wday == 0 + date -= 6 + end + date + +tests: + - given: + date: '2008-01-01' + regions: ["tsx"] + options: ["informal"] + expect: + name: "New Year's Day" + - given: + date: '2008-03-21' + regions: ["tsx"] + options: ["informal"] + expect: + name: "Good Friday" + - given: + date: '2008-07-01' + regions: ["tsx"] + options: ["informal"] + expect: + name: "Canada Day" + - given: + date: '2008-09-01' + regions: ["tsx"] + options: ["informal"] + expect: + name: "Labour Day" + - given: + date: '2008-12-25' + regions: ["tsx"] + options: ["informal"] + expect: + name: "Christmas Day" + + # Family Day in Ontario - should not be active before 2008 + - given: + date: '1970-02-16' + regions: ["tsx"] + expect: + holiday: false + - given: + date: '1988-02-15' + regions: ["tsx"] + expect: + holiday: false + - given: + date: '1989-02-20' + regions: ["tsx"] + expect: + holiday: false + - given: + date: '2006-02-20' + regions: ["tsx"] + expect: + holiday: false + - given: + date: '2007-02-19' + regions: ["tsx"] + expect: + holiday: false + + # New years observed date + - given: + date: '2011-01-03' + regions: ["tsx"] + options: ["observed"] + expect: + name: "New Year's Day" + - given: + date: '2012-01-02' + regions: ["tsx"] + options: ["observed"] + expect: + name: "New Year's Day" + - given: + date: '2016-01-01' + regions: ["tsx"] + options: ["observed"] + expect: + name: "New Year's Day" + + # Canada Day observed date + - given: + date: '2011-07-01' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Canada Day" + - given: + date: '2012-07-02' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Canada Day" + - given: + date: '2017-07-03' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Canada Day" + + # Christmas Day + - given: + date: '2010-12-25' + regions: ["tsx"] + expect: + name: "Christmas Day" + - given: + date: '2018-12-25' + regions: ["tsx"] + expect: + name: "Christmas Day" + - given: + date: '2022-12-25' + regions: ["tsx"] + expect: + name: "Christmas Day" + - given: + date: '2022-12-25' + regions: ["tsx"] + options: ["observed"] + expect: + holiday: false + + # Christmas Day observed date + - given: + date: '2010-12-24' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Christmas Day" + - given: + date: '2012-12-25' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Christmas Day" + - given: + date: '2016-12-26' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Christmas Day" + - given: + date: '2021-12-27' + regions: [ "tsx" ] + options: [ "observed" ] + expect: + name: "Christmas Day" + - given: + date: '2022-12-26' + regions: ["tsx"] + options: ["observed"] + expect: + name: "Christmas Day" + + - given: + date: ['2010-12-27', '2012-12-26', '2015-12-28'] + regions: ["tsx"] + options: ["observed"] + expect: + name: "Boxing Day" + + - given: + date: ['2022-05-23', '2021-05-24'] + regions: ['tsx'] + expect: + name: "Victoria Day" + - given: + date: '2015-05-24' + regions: ["tsx"] + options: ["observed"] + expect: + holiday: false From 0273ffc9f04ff134bcceaaccf8e5a5f43503b8ec Mon Sep 17 00:00:00 2001 From: DagonWat Date: Mon, 26 Sep 2022 09:34:45 +0300 Subject: [PATCH 02/11] Add Israel holidays for 2022-2026 years --- il.yaml | 329 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 il.yaml diff --git a/il.yaml b/il.yaml new file mode 100644 index 0000000..91aa2d9 --- /dev/null +++ b/il.yaml @@ -0,0 +1,329 @@ +# Israel holiday definitions for the Ruby Holiday gem. +# Updated 2022-09-14. +# +# Sources: +# - https://www.worlddata.info/asia/israel/public-holidays.php +# +# Notes: +# - ATTENTION: these calculations are only going to work from 2022 year till 2026 year. +# - Israel has its own way of calculation holidays (different calendar). +# - In case of holidays being out of date - message voiteh322@gmail.com to update. +--- +months: + 3: + - name: Exodus from Egypt + regions: [il] + mday: 16 + year_ranges: + limited: [ 2022 ] + - name: Exodus from Egypt + regions: [il] + mday: 6 + year_ranges: + limited: [ 2023 ] + - name: Exodus from Egypt + regions: [il] + mday: 23 + year_ranges: + limited: [ 2024 ] + - name: Exodus from Egypt + regions: [il] + mday: 13 + year_ranges: + limited: [ 2025 ] + - name: Exodus from Egypt + regions: [il] + mday: 2 + year_ranges: + limited: [ 2026 ] + - name: Exodus from Egypt (day 7) + regions: [il] + mday: 22 + year_ranges: + limited: [ 2022 ] + - name: Exodus from Egypt (day 7) + regions: [il] + mday: 12 + year_ranges: + limited: [ 2023 ] + - name: Exodus from Egypt (day 7) + regions: [il] + mday: 29 + year_ranges: + limited: [ 2024 ] + - name: Exodus from Egypt (day 7) + regions: [il] + mday: 19 + year_ranges: + limited: [ 2025 ] + - name: Exodus from Egypt (day 7) + regions: [il] + mday: 8 + year_ranges: + limited: [ 2026 ] + - name: Independence Day + regions: [il] + mday: 24 + year_ranges: + limited: [ 2023 ] + - name: Independence Day + regions: [il] + mday: 20 + year_ranges: + limited: [ 2026 ] + 4: + - name: Independence Day + regions: [il] + mday: 4 + year_ranges: + limited: [ 2022 ] + - name: Independence Day + regions: [il] + mday: 11 + year_ranges: + limited: [ 2024 ] + - name: Independence Day + regions: [il] + mday: 1 + year_ranges: + limited: [ 2025 ] + - name: Thanksgiving + regions: [il] + mday: 26 + year_ranges: + limited: [ 2023 ] + - name: Thanksgiving + regions: [il] + mday: 22 + year_ranges: + limited: [ 2026 ] + - name: Thanksgiving (day 2) + regions: [il] + mday: 27 + year_ranges: + limited: [ 2023 ] + - name: Thanksgiving (day 2) + regions: [il] + mday: 23 + year_ranges: + limited: [ 2026 ] + 5: + - name: Thanksgiving + regions: [il] + mday: 5 + year_ranges: + limited: [ 2022 ] + - name: Thanksgiving + regions: [il] + mday: 12 + year_ranges: + limited: [ 2024 ] + - name: Thanksgiving + regions: [il] + mday: 2 + year_ranges: + limited: [ 2025 ] + - name: Thanksgiving (day 2) + regions: [il] + mday: 6 + year_ranges: + limited: [ 2022 ] + - name: Thanksgiving (day 2) + regions: [il] + mday: 13 + year_ranges: + limited: [ 2024 ] + - name: Thanksgiving (day 2) + regions: [il] + mday: 3 + year_ranges: + limited: [ 2025 ] + 9: + - name: Jewish New Year + regions: [il] + mday: 26 + year_ranges: + limited: [ 2022 ] + - name: Jewish New Year + regions: [il] + mday: 16 + year_ranges: + limited: [ 2023 ] + - name: Jewish New Year + regions: [il] + mday: 23 + year_ranges: + limited: [ 2025 ] + - name: Jewish New Year + regions: [il] + mday: 12 + year_ranges: + limited: [ 2026 ] + - name: 2nd New Year's Day + regions: [il] + mday: 27 + year_ranges: + limited: [ 2022 ] + - name: 2nd New Year's Day + regions: [il] + mday: 17 + year_ranges: + limited: [ 2023 ] + - name: 2nd New Year's Day + regions: [il] + mday: 24 + year_ranges: + limited: [ 2025 ] + - name: 2nd New Year's Day + regions: [il] + mday: 13 + year_ranges: + limited: [ 2026 ] + - name: Day of Atonement + regions: [il] + mday: 25 + year_ranges: + limited: [ 2023 ] + - name: Day of Atonement + regions: [il] + mday: 21 + year_ranges: + limited: [ 2026 ] + - name: Feast of Tabernacles + regions: [il] + mday: 30 + year_ranges: + limited: [ 2023 ] + - name: Feast of Tabernacles + regions: [il] + mday: 26 + year_ranges: + limited: [ 2026 ] + 10: + - name: Jewish New Year + regions: [il] + mday: 3 + year_ranges: + limited: [ 2024 ] + - name: 2nd New Year's Day + regions: [il] + mday: 4 + year_ranges: + limited: [ 2024 ] + - name: Day of Atonement + regions: [il] + mday: 5 + year_ranges: + limited: [ 2022 ] + - name: Day of Atonement + regions: [il] + mday: 12 + year_ranges: + limited: [ 2024 ] + - name: Day of Atonement + regions: [il] + mday: 2 + year_ranges: + limited: [ 2025 ] + - name: Feast of Tabernacles + regions: [il] + mday: 10 + year_ranges: + limited: [ 2022 ] + - name: Feast of Tabernacles + regions: [il] + mday: 17 + year_ranges: + limited: [ 2024 ] + - name: Feast of Tabernacles + regions: [il] + mday: 7 + year_ranges: + limited: [ 2025 ] + - name: Rejoicing of the Torah + regions: [il] + mday: 18 + year_ranges: + limited: [ 2022 ] + - name: Rejoicing of the Torah + regions: [il] + mday: 8 + year_ranges: + limited: [ 2023 ] + - name: Rejoicing of the Torah + regions: [il] + mday: 25 + year_ranges: + limited: [ 2024 ] + - name: Rejoicing of the Torah + regions: [il] + mday: 15 + year_ranges: + limited: [ 2025 ] + - name: Rejoicing of the Torah + regions: [il] + mday: 4 + year_ranges: + limited: [ 2026 ] + +tests: + - given: + date: '2024-03-23' + regions: ["il"] + expect: + name: "Exodus from Egypt" + - given: + date: '2023-03-12' + regions: ["il"] + expect: + name: "Exodus from Egypt (day 7)" + - given: + date: '2025-04-01' + regions: ["il"] + expect: + name: "Independence Day" + - given: + date: '2026-04-22' + regions: ["il"] + expect: + name: "Thanksgiving" + - given: + date: '2024-05-13' + regions: ["il"] + expect: + name: "Thanksgiving (day 2)" + - given: + date: '2023-09-16' + regions: ["il"] + expect: + name: "Jewish New Year" + - given: + date: '2025-09-24' + regions: ["il"] + expect: + name: "2nd New Year's Day" + - given: + date: '2026-09-21' + regions: ["il"] + expect: + name: "Day of Atonement" + - given: + date: '2024-10-17' + regions: ["il"] + expect: + name: "Feast of Tabernacles" + - given: + date: '2025-10-15' + regions: ["il"] + expect: + name: "Rejoicing of the Torah" + - given: + date: '2024-07-09' + regions: ['il'] + expect: + holiday: false + - given: + date: '2026-08-15' + regions: ['il'] + expect: + holiday: false From 642f117ad4f511c930ffcadc21655dba1e5fc496 Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Wed, 26 Oct 2022 12:41:52 +0800 Subject: [PATCH 03/11] fix lunar new year day for 2023 and 2030 --- hk.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hk.yaml b/hk.yaml index a884b98..2192b93 100644 --- a/hk.yaml +++ b/hk.yaml @@ -25,7 +25,7 @@ months: regions: [hk] function: cn_new_lunar_day(year) function_modifier: 2 - observed: to_weekday_if_boxing_weekend(date) + observed: to_monday_if_sunday(date) - name: Good Friday regions: [hk] function: easter(year) @@ -105,11 +105,11 @@ methods: [2, 13] when 1946, 2003, 2022, 2041, 2052, 2098, 2147, 2155, 2166, 2223, 2242, 2261, 2299, 2310, 2375, 2394 [2, 1] - when 1947, 2004, 2042, 2050, 2080, 2118, 2137, 2194, 2270, 2289, 2300, 2338, 2376 + when 1947, 2004, 2023, 2042, 2050, 2080, 2118, 2137, 2194, 2270, 2289, 2300, 2338, 2376 [1, 22] when 1948, 1994, 2013, 2024, 2043, 2089, 2119, 2138, 2157, 2176, 2195, 2214, 2320, 2396 [2, 10] - when 1954, 1973, 2011, 2057, 2068, 2087, 2125, 2163, 2231, 2277, 2288, 2345, 2383 + when 1954, 1973, 2011, 2030, 2057, 2068, 2087, 2125, 2163, 2231, 2277, 2288, 2345, 2383 [2, 3] when 1956, 2002, 2021, 2059, 2078, 2097, 2135, 2154, 2173, 2184, 2203, 2222, 2241, 2279, 2287, 2298, 2355, 2374, 2393 [2, 12] @@ -119,9 +119,9 @@ methods: [1, 28] when 1962, 1981, 2000, 2019, 2065, 2076, 2084, 2095, 2133, 2152, 2171, 2190, 2220, 2239, 2285, 2315, 2334, 2353, 2372, 2391 [2, 5] - when 1965, 1984, 2030, 2049, 2060, 2079, 2117, 2136, 2174, 2182, 2193, 2204, 2250, 2269, 2280, 2318, 2337, 2356 + when 1965, 1984, 2049, 2060, 2079, 2117, 2136, 2174, 2182, 2193, 2204, 2250, 2269, 2280, 2318, 2337, 2356 [2, 2] - when 1966, 2023, 2061, 2099, 2186, 2262, 2281, 2357, 2395 + when 1966, 2061, 2099, 2186, 2262, 2281, 2357, 2395 [1, 21] when 1967, 1986, 2005, 2062, 2100, 2168, 2233, 2244, 2263, 2282, 2301, 2339, 2377, 2385, 2388 [2, 9] From db65bbb103c00088465f14395d868019b0b02a60 Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Wed, 26 Oct 2022 15:24:30 +0800 Subject: [PATCH 04/11] draft: hk holidays 2023 --- METHODS.yml | 4 ++ hk.yaml | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 4 deletions(-) diff --git a/METHODS.yml b/METHODS.yml index c3e80aa..6876ee0 100644 --- a/METHODS.yml +++ b/METHODS.yml @@ -24,3 +24,7 @@ methods: arguments: date lunar_to_solar: arguments: year, month, day, region + to_the_next_weekday_after: + arguments: date + to_the_second_weekday_after: + arguments: date diff --git a/hk.yaml b/hk.yaml index 2192b93..683a32a 100644 --- a/hk.yaml +++ b/hk.yaml @@ -9,6 +9,7 @@ # Source: # http://www.gov.hk/en/about/abouthk/holiday/ +# https://en.wikipedia.org/wiki/Public_holidays_in_Hong_Kong months: 0: @@ -19,13 +20,11 @@ months: - name: The second day of Lunar New Year regions: [hk] function: cn_new_lunar_day(year) - function_modifier: 1 - observed: to_monday_if_sunday(date) + observed: to_the_weekday_after(date) - name: The third day of Lunar New Year regions: [hk] function: cn_new_lunar_day(year) - function_modifier: 2 - observed: to_monday_if_sunday(date) + observed: to_the_second_weekday_after(date) - name: Good Friday regions: [hk] function: easter(year) @@ -285,3 +284,105 @@ tests: options: ["observed"] expect: name: "Boxing Day" + - given: + date: '2023-01-02' + regions: ["hk"] + options: ["observed"] + expect: + name: "New Year's Day" + - given: + date: '2023-01-23' + regions: ["hk"] + options: ["observed"] + expect: + name: "Lunar New Year's Day" + - given: + date: '2023-01-24' + regions: ["hk"] + options: ["observed"] + expect: + name: "The second day of Lunar New Year" + - given: + date: '2023-01-25' + regions: ["hk"] + options: ["observed"] + expect: + name: "The third day of Lunar New Year" + - given: + date: '2023-04-05' + regions: ["hk"] + options: ["observed"] + expect: + name: "Ching Ming Festival" + - given: + date: '2023-04-07' + regions: ["hk"] + options: ["observed"] + expect: + name: "Good Friday" + - given: + date: '2023-04-08' + regions: ["hk"] + options: ["observed"] + expect: + name: "The day following Good Friday" + - given: + date: '2023-04-10' + regions: ["hk"] + options: ["observed"] + expect: + name: "Easter Monday" + - given: + date: '2023-05-01' + regions: ["hk"] + options: ["observed"] + expect: + name: "Labour Day" + - given: + date: '2023-05-26' + regions: ["hk"] + options: ["observed"] + expect: + name: "The Birthday of the Buddha" + - given: + date: '2023-06-22' + regions: ["hk"] + options: ["observed"] + expect: + name: "Tuen Ng Festival" + - given: + date: '2023-07-01' + regions: ["hk"] + options: ["observed"] + expect: + name: "Hong Kong Special Administrative Region Establishment Day" + - given: + date: '2023-09-30' + regions: ["hk"] + options: ["observed"] + expect: + name: "The day following the Chinese Mid-Autumn Festival" + - given: + date: '2023-10-02' + regions: ["hk"] + options: ["observed"] + expect: + name: "National Day" + - given: + date: '2023-10-23' + regions: ["hk"] + options: ["observed"] + expect: + name: "Chung Yeung Festival" + - given: + date: '2023-12-25' + regions: ["hk"] + options: ["observed"] + expect: + name: "Christmas Day" + - given: + date: '2023-12-26' + regions: ["hk"] + options: ["observed"] + expect: + name: "Boxing Day" From 8d139f87d7100b11b89e5431d071f4ded3b13f6b Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Wed, 26 Oct 2022 16:46:53 +0800 Subject: [PATCH 05/11] use lunar calendar --- METHODS.yml | 2 ++ hk.yaml | 62 +++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/METHODS.yml b/METHODS.yml index 6876ee0..27affd8 100644 --- a/METHODS.yml +++ b/METHODS.yml @@ -28,3 +28,5 @@ methods: arguments: date to_the_second_weekday_after: arguments: date + to_previous_day_if_leap_year: + arguments: date diff --git a/hk.yaml b/hk.yaml index 683a32a..707e8c1 100644 --- a/hk.yaml +++ b/hk.yaml @@ -1,30 +1,22 @@ # Hong Kong holiday definitions for the Holidays gem! -# Days not included in the definitions (yet): +# The following holidays are based on the Chinese lunar calendar: +# Lunar New Year's Day # Ching Ming Festival # The Birthday of the Buddha # Tuen Ng Festival # Chinese Mid-Autumn Festival # Chung Yeung Festival +# The Chinese lunar calendar has been copied from the Vietnamese lunar calendar. +# Only the year 2022, 2023, 2024 have been updated. You should assume that the other years are incorrect. + # Source: # http://www.gov.hk/en/about/abouthk/holiday/ # https://en.wikipedia.org/wiki/Public_holidays_in_Hong_Kong months: 0: - - name: Lunar New Year's Day - regions: [hk] - function: cn_new_lunar_day(year) - observed: to_monday_if_sunday(date) - - name: The second day of Lunar New Year - regions: [hk] - function: cn_new_lunar_day(year) - observed: to_the_weekday_after(date) - - name: The third day of Lunar New Year - regions: [hk] - function: cn_new_lunar_day(year) - observed: to_the_second_weekday_after(date) - name: Good Friday regions: [hk] function: easter(year) @@ -42,16 +34,58 @@ months: regions: [hk] mday: 1 observed: to_monday_if_sunday(date) + - name: Lunar New Year's Day + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 1 + observed: to_monday_if_sunday(date) + - name: The second day of Lunar New Year + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 1 + observed: to_the_weekday_after(date) + - name: The third day of Lunar New Year + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 1 + observed: to_the_second_weekday_after(date) + 4: + - name: Ching Ming Festival + regions: [hk] + mday: 5 + observed: to_previous_day_if_leap_year(date) + - name: Buddha's Birthday + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 8 + observed: to_monday_if_sunday(date) 5: - name: Labour Day regions: [hk] mday: 1 observed: to_monday_if_sunday(date) + - name: Tuen Ng Festival + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 5 + observed: to_monday_if_sunday(date) 7: - name: Hong Kong Special Administrative Region Establishment Day regions: [hk] mday: 1 observed: to_monday_if_sunday(date) + 8: + - name: The day following the Chinese Mid-Autumn Festival + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 16 + observed: to_monday_if_sunday(date) + 9: + - name: Chung Yeung Festival + regions: [hk] + function: lunar_to_solar(year, month, day, region) + mday: 9 + observed: to_monday_if_sunday(date) 10: - name: National Day regions: [hk] @@ -343,7 +377,7 @@ tests: regions: ["hk"] options: ["observed"] expect: - name: "The Birthday of the Buddha" + name: "Buddha's Birthday" - given: date: '2023-06-22' regions: ["hk"] From 8e7061fa8a43645aa164ce4ac94963449362408f Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Wed, 26 Oct 2022 16:48:01 +0800 Subject: [PATCH 06/11] remove unused function --- hk.yaml | 72 --------------------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/hk.yaml b/hk.yaml index 707e8c1..c71e5a9 100644 --- a/hk.yaml +++ b/hk.yaml @@ -101,78 +101,6 @@ months: mday: 26 observed: to_weekday_if_boxing_weekend(date) -methods: - cn_new_lunar_day: - arguments: year - ruby: | - month_day = case year - when 1930, 1949, 1987, 2025, 2063, 2082, 2101, 2112, 2131, 2150, 2207, 2245, 2253, 2283, 2321 - [1, 29] - when 1931, 1950, 1969, 1988, 2007, 2026, 2045, 2083, 2091, 2102, 2121, 2159, 2197, 2208, 2216, 2227, 2246, 2265, 2303, 2322, 2341, 2379 - [2, 17] - when 1932, 1951, 1970, 1989, 2027, 2046, 2114, 2179, 2198, 2209, 2247, 2266, 2304, 2323, 2342, 2361, 2399 - [2, 6] - when 1933, 2009, 2028, 2047, 2066, 2085, 2115, 2161, 2199, 2210, 2229, 2267, 2305, 2316, 2324, 2335, 2381 - [1, 26] - when 1934, 1953, 2037, 2048, 2067, 2086, 2105, 2116, 2181, 2189, 2211, 2257, 2268, 2306, 2325, 2336 - [2, 14] - when 1935, 1943, 1992, 2038, 2106, 2144, 2201, 2212, 2258, 2296, 2307, 2326, 2364 - [2, 4] - when 1936, 1955, 2001, 2039, 2058, 2088, 2107, 2164, 2183, 2221, 2259, 2278, 2308, 2327, 2373 - [1, 24] - when 1937, 1975, 2032, 2040, 2051, 2070, 2108, 2127, 2146, 2165, 2252, 2260, 2271, 2290, 2309, 2328, 2347, 2366 - [2, 11] - when 1938, 1957, 1976, 1995, 2014, 2033, 2071, 2109, 2128, 2185, 2272, 2291, 2329, 2348, 2367, 2386 - [1, 31] - when 1939, 1996, 2015, 2053, 2072, 2110, 2129, 2292, 2330, 2368, 2387 - [2, 19] - when 1940, 1959, 2016, 2035, 2081, 2130, 2149, 2187, 2206, 2225, 2236, 2255, 2312, 2350, 2358, 2369 - [2, 8] - when 1941, 1952, 1971, 1990, 2074, 2093, 2123, 2142, 2180, 2248, 2294, 2343, 2351, 2362 - [1, 27] - when 1942, 1961, 1972, 1991, 2056, 2075, 2094, 2124, 2143, 2200, 2276, 2295, 2344, 2363 - [2, 15] - when 1944, 1963, 1982, 2020, 2096, 2134, 2153, 2172, 2191, 2202, 2240, 2286, 2354, 2392 - [1, 25] - when 1945, 1964, 1983, 2010, 2029, 2162, 2192, 2230, 2249, 2317, 2382 - [2, 13] - when 1946, 2003, 2022, 2041, 2052, 2098, 2147, 2155, 2166, 2223, 2242, 2261, 2299, 2310, 2375, 2394 - [2, 1] - when 1947, 2004, 2023, 2042, 2050, 2080, 2118, 2137, 2194, 2270, 2289, 2300, 2338, 2376 - [1, 22] - when 1948, 1994, 2013, 2024, 2043, 2089, 2119, 2138, 2157, 2176, 2195, 2214, 2320, 2396 - [2, 10] - when 1954, 1973, 2011, 2030, 2057, 2068, 2087, 2125, 2163, 2231, 2277, 2288, 2345, 2383 - [2, 3] - when 1956, 2002, 2021, 2059, 2078, 2097, 2135, 2154, 2173, 2184, 2203, 2222, 2241, 2279, 2287, 2298, 2355, 2374, 2393 - [2, 12] - when 1958, 1977, 2034, 2140, 2178, 2235, 2254, 2273, 2311, 2349, 2360, 2398 - [2, 18] - when 1960, 1979, 1998, 2006, 2017, 2036, 2055, 2104, 2169, 2188, 2218, 2226, 2237, 2256, 2275, 2313, 2332, 2370, 2389 - [1, 28] - when 1962, 1981, 2000, 2019, 2065, 2076, 2084, 2095, 2133, 2152, 2171, 2190, 2220, 2239, 2285, 2315, 2334, 2353, 2372, 2391 - [2, 5] - when 1965, 1984, 2049, 2060, 2079, 2117, 2136, 2174, 2182, 2193, 2204, 2250, 2269, 2280, 2318, 2337, 2356 - [2, 2] - when 1966, 2061, 2099, 2186, 2262, 2281, 2357, 2395 - [1, 21] - when 1967, 1986, 2005, 2062, 2100, 2168, 2233, 2244, 2263, 2282, 2301, 2339, 2377, 2385, 2388 - [2, 9] - when 1968, 2044, 2090, 2120, 2139, 2158, 2177, 2196, 2215, 2234, 2264, 2302, 2340, 2359, 2378, 2397 - [1, 30] - when 1974, 1993, 2012, 2031, 2069, 2077, 2126, 2145, 2156, 2175, 2213, 2232, 2251, 2297, 2346, 2365, 2384 - [1, 23] - when 1978, 1997, 2008, 2054, 2073, 2092, 2103, 2111, 2122, 2141, 2160, 2217, 2228, 2274, 2293, 2331, 2380 - [2, 7] - when 1980, 1999, 2018, 2064, 2113, 2132, 2151, 2170, 2219, 2238, 2284, 2314, 2333, 2352, 2371, 2390 - [2, 16] - when 1985, 2148, 2167, 2205, 2224, 2243 - [2, 20] - when 2319 - [2, 21] - end - Date.civil(year, month_day[0], month_day[1]) - tests: - given: date: '2016-01-01' From 937c932698f4ec410dfc831f6faced042a273f96 Mon Sep 17 00:00:00 2001 From: Matthew Nguyen Date: Fri, 28 Oct 2022 01:44:34 +0800 Subject: [PATCH 07/11] remove obsolete comments --- hk.yaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hk.yaml b/hk.yaml index c71e5a9..c06df60 100644 --- a/hk.yaml +++ b/hk.yaml @@ -1,16 +1,5 @@ # Hong Kong holiday definitions for the Holidays gem! -# The following holidays are based on the Chinese lunar calendar: -# Lunar New Year's Day -# Ching Ming Festival -# The Birthday of the Buddha -# Tuen Ng Festival -# Chinese Mid-Autumn Festival -# Chung Yeung Festival - -# The Chinese lunar calendar has been copied from the Vietnamese lunar calendar. -# Only the year 2022, 2023, 2024 have been updated. You should assume that the other years are incorrect. - # Source: # http://www.gov.hk/en/about/abouthk/holiday/ # https://en.wikipedia.org/wiki/Public_holidays_in_Hong_Kong From 7c4991d68abce49dc27d4eddb18da7656faa7236 Mon Sep 17 00:00:00 2001 From: Phil Peble Date: Thu, 23 May 2024 01:37:19 -0500 Subject: [PATCH 08/11] Fix missing GR entry in index.yaml --- CHANGELOG.md | 4 ++++ index.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 166fceb..5f75540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Holiday definitions +## 5.7.4 + +* Fix missing GR entry in index.yaml + ## 5.7.3 * Fix stupid naming problem in Greece yaml file diff --git a/index.yaml b/index.yaml index e1f48a6..6ec5f4b 100644 --- a/index.yaml +++ b/index.yaml @@ -26,6 +26,7 @@ defs: FR: ['fr.yaml'] GB: ['gb.yaml'] GE: ['ge.yaml'] + GR: ['gr.yaml'] HR: ['hr.yaml'] HK: ['hk.yaml'] HU: ['hu.yaml'] From 7768279057f0ded2441249f49baca5a061ce6a2b Mon Sep 17 00:00:00 2001 From: Phil Peble Date: Thu, 23 May 2024 02:05:31 -0500 Subject: [PATCH 09/11] Fix lt YAML in index --- lt.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/lt.yaml b/lt.yaml index 6b6f12e..92073b3 100644 --- a/lt.yaml +++ b/lt.yaml @@ -46,7 +46,6 @@ months: - name: Visų šventųjų diena regions: [lt] mday: 1 - 11: - name: Mirusiųjų atminimo (Vėlinių) diena regions: [lt] mday: 2 From 37cac370127d54f2c9a81cbedacc2e174919f33f Mon Sep 17 00:00:00 2001 From: Phil Peble Date: Sun, 11 Aug 2024 01:53:50 -0500 Subject: [PATCH 10/11] FIX: tasmania / nsw / vic do not observe on Monday --- au.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/au.yaml b/au.yaml index 9d8f566..5956f8f 100644 --- a/au.yaml +++ b/au.yaml @@ -71,7 +71,7 @@ months: regions: [au] mday: 25 - name: ANZAC Day - regions: [au_nsw, au_qld, au_nt, au_act, au_sa, au_tas] + regions: [au_qld, au_nt, au_act, au_sa] mday: 25 observed: to_monday_if_sunday(date) - name: ANZAC Day From 17473c8973d0d0429cb6d02e44fff727beee1762 Mon Sep 17 00:00:00 2001 From: Phil Peble Date: Sun, 11 Aug 2024 02:08:37 -0500 Subject: [PATCH 11/11] Added Weltkindertag and some historical data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Weltkindertag has been added as a new holiday for Thuringia (since 2019) - Historical data for Heilige Drei Könige for Sachsen-Anhalt (since 1991) - Historical data for Buß- und Bettag - Historical data for Friedensfest (since 1950) - Historical data for Tag der Arbeit (since 1933) --- de.yaml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/de.yaml b/de.yaml index 5c6b5f0..6558d1d 100644 --- a/de.yaml +++ b/de.yaml @@ -26,6 +26,13 @@ # Change 2023-04-17: # - Historical data for Tag der Deutschen Einheit # +## Change 2024-03-16: +# - Weltkindertag has been added as a new holiday for Thuringia (since 2019) +# - Historical data for Heilige Drei Könige for Sachsen-Anhalt (since 1991) +# - Historical data for Buß- und Bettag +# - Historical data for Friedensfest (since 1950) +# - Historical data for Tag der Arbeit (since 1933) +# # Sources: # - http://en.wikipedia.org/wiki/Holidays_in_Germany # - http://www.timeanddate.com/calendar/index.html?country=8 @@ -84,8 +91,13 @@ months: regions: [de] mday: 1 - name: Heilige Drei Könige - regions: [de_bw, de_by, de_st] + regions: [de_bw, de_by] + mday: 6 + - name: Heilige Drei Könige + regions: [de_st] mday: 6 + year_ranges: + from: 1991 3: - name: Internationaler Frauentag regions: [de_be] @@ -101,6 +113,8 @@ months: - name: Tag der Arbeit regions: [de] mday: 1 + year_ranges: + from: 1933 - name: Tag der Befreiung regions: [de_be] mday: 8 @@ -121,6 +135,8 @@ months: - name: Friedensfest regions: [de_by_augsburg] mday: 8 + year_ranges: + from: 1950 9: - name: Weltkindertag regions: [de_th] @@ -157,6 +173,20 @@ months: - name: Buß- und Bettag regions: [de_sn] function: de_buss_und_bettag(year) + year_ranges: + from: 1990 + - name: Buß- und Bettag + regions: [de_bw, de_by, de_be, de_hb, de_hh, de_he, de_ni, de_nw, de_rp, de_sl, de_sh] + function: de_buss_und_bettag(year) + year_ranges: + until: 1994 + - name: Buß- und Bettag + regions: [de_bb, de_mv, de_st, de_th] + function: de_buss_und_bettag(year) + year_ranges: + between: + start: 1990 + end: 1994 12: - name: Heilig Abend regions: [de]