8000 Add Tuvalu holidays · Issue #1291 · vacanza/holidays · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add Tuvalu holidays #1291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arkid15r opened this issue Jun 6, 2023 · 19 comments · Fixed by #2295
Closed

Add Tuvalu holidays #1291

arkid15r opened this issue Jun 6, 2023 · 19 comments · Fixed by #2295
Assignees

Comments

@arkid15r
Copy link
Collaborator
arkid15r commented Jun 6, 2023

Links:

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 10, 2025

@Prateekshit73 While waiting for Fiji, I think this might work as well 👀

This has subdivisions-specific holidays that you might wanna try implementing as listed on the Wikipedia; as for l10n I think en 8000 _GB and en_US is suffice for now.

Additional Sources:

Holidays Law (as we only have sources for 1990 onwards, I would recommend using that as our start_year)

Subdivision ISO code and their full name (addable as subdivisions_aliases):

@Prateekshit73
Copy link
Collaborator

Thank you for mentioning me to work on this issue and for providing the necessary information to get started. I appreciate your support and guidance!

@Prateekshit73
Copy link
Collaborator

As referenced in the section on Public holidays in Tuvalu, we have the Tuvaluan name. Should I add this language as well, or should I keep it limited to en_GB and en_US?

@PPsyrius
Copy link
Collaborator

@Prateekshit73 You're free to include them as well though I'm concerned about some missing entries (I don't see the translation for Good Friday in T 8000 uvaluan on Wikipedia for example) - if you can find the sources for them then this would be perfect 🙏

@Prateekshit73
Copy link
Collaborator

Here are some references, as listed below:-

Friday
    Aso Lima ( )
asolima 

Am I allowed to consider these references?

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 10, 2025

Here are some references, as listed below:-

Friday
    Aso Lima ( )
asolima 

Am I allowed to consider these references?

@Prateekshit73 I checked for both Easter and "Good Friday" on Glosbe, the results are sadly empty for both of them 😔

I would recommend reaching out to Ekalesia Kelisiano Tuvalu FB page instead in this particular case.

@Prateekshit73
Copy link
Collaborator

Thank you for your feedback, @PPsyrius! I appreciate your guidance on the references. I will reach out to the Ekalesia Kelisiano Tuvalu Facebook page to gather more information about the translations for "Good Friday" and any other missing entries. Once I have the necessary details, I’ll proceed with adding the Tuvaluan names for the holidays.

If you have any other suggestions or resources, please let me know. Thanks again for your support!

@Prateekshit73
Copy link
Collaborator

Hello @PPsyrius, I wanted to seek your guidance on handling the National Children’s event, which is on the first Monday after White Sunday, and White Sunday falling on the second Sunday of October.

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 11, 2025

@Prateekshit73 Hi, regarding this - I would recommend implement the following code snippet:

If White Sunday itself is also a Public Holiday:

from holidays.calendars.gregorian import _timedelta
        # White Sunday.
        dt = self._add_holiday_2nd_sun_of_oct(tr("White Sunday"))

        # National Children's Day.
        self._add_holiday(tr("National Children's Day"), _timedelta(dt, +1))

If White Sunday isn't a Public Holiday:

        # National Children's Day.
        self._add_holiday_1_day_past_2nd_sun_of_oct(tr("National Children's Day"))

@Prateekshit73
Copy link
Collaborator

Since it is referenced in the Public Holiday Act 2018 and later, and was not present in the Public Holiday Act 2008, should I implement it as self._year >= 2018?

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 12, 2025

@Prateekshit73 Yes, I would suggest doing a National Children's Day date change trigger for 2019 (note that the law came into effect in Nov 2018 - so it's a bit too late for that year).

National Youth Day can either uses the same trigger as shown below or done separately as you see fit 🙂

	# National Children's Day.
	name = tr("National Children's Day")
	if self._year >= 2019:
		self._add_holiday_1_day_past_2nd_sun_of_oct(name)
		# National Youth Day.
		self._add_holidat_1st_mon_of_aug(tr("National Youth Day"))
	else:
		self._add_holidat_1st_mon_of_aug(name)

@Prateekshit73
Copy link
Collaborator

Here in Wikipedia, it states that:

  • moveable in autumn | Easter

So, for Easter, should we consider using self._add_easter_sunday?

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 12, 2025

Here in Wikipedia, it states that:

  • moveable in autumn | Easter

So, for Easter, should we consider using self._add_easter_sunday?

@Prateekshit73 I think that's probably some copy-n-paste mistake since the German language page appears correctly, Holy Saturday and Easter Sunday were never listed as part of their public holidays list.

The actual law (i.e. 2022 amendment) clearly states "Easter Monday" so we're using self._add_easter_monday(tr("Easter Monday")) here. 👍

@Prateekshit73
Copy link
Collaborator

Hi @PPsyrius,

I wanted to ask about the implementation of subdivision-specific holidays as stated in Tuvalu News TV that you referenced.

I am a bit confused about how these subdiv_public_holidays work.

    def _populate_subdiv_nui_public_holidays(self):
        # Nanumaga Day.
        self._add_observed(self._add_holiday_apr_15(tr("Aho o te Fakavae")))

        if self._year >= 2015:
            # Cyclone Day.
            self._add_observed(self._add_holiday_mar_22(tr("Aso o te matagi")))

            # Nukufetau Day.
            self._add_observed(self._add_holiday_feb_16(tr("Te Aso o Tutasi")))

    def _populate_subdiv_vai_public_holidays(self):
        # Cyclone Day.
        self._add_observed(self._add_holiday_jan_30(tr("Aso o te matagi")))
        # Cyclone Day.
        self._add_observed(self._add_holiday_feb_1(tr("Aso o te matagi")))

        if self._year >= 2015:
            # Cyclone Day.
            self._add_observed(self._add_holiday_mar_15(tr("Aso o te matagi")))

        # Nanumaga Day.
        self._add_observed(self._add_holiday_apr_15(tr("Aho o te Fakavae")))

    def _populate_subdiv_nkl_public_holidays(self):

        # Nanumaga Day.
        self._add_observed(self._add_holiday_may_10(tr("Aho o te Fakavae")))

I tried to study other examples and replicate them, but the holidays they include either have different years or feature unique holidays. In our case, one subdivision has a different year, while the others vary by the date of the same holiday.

Now, the problem is:

  1. Do I need to repeat the implementation for other subdivisions with the same holiday, or should I implement it in the public holiday code with the three subdivisions mentioned above?

  2. Will the test case for this be the same as the one below for every subdivision?

    def test_nma_holidays(self):
        nma_holidays = Tuvalu(subdiv="NMA", years=range(1990, 2050))

        name = "Aho o te Fakavae"
        self.assertHolidayName(name, nma_holidays, (f"{year}-04-15" for year in range(1990, 2050)))
        self.assertNoHolidayName(name)

I apologize for being so dull.

@PPsyrius
Copy link
Collaborator
PPsyrius commented Feb 13, 2025

@Prateekshit73 Unless I misunderstood the original source for Tuvalu's case, it's more like the code I provided below - none of the subdivision-specific start dates mentioned in Wikipedia affects us at all since all of them predate our own 1990 start_year.

	subdivisions = (
		"FUN",  # Funafuti.
		"NMG",  # Nanumaga.
		"NMA",  # Nanumea.
		"NIT",  # Niutao.
		"NUI",  # Nui.
		"NKF",  # Nukufetau.
		"NKL",  # Nukulaelae.
		"VAI",  # Vaitupu.
	)
	subdivisions_aliases = {
		# Town/Island Councils.
		"Funafuti": "FUN",
		"Nanumaga": "NMG",
		"Nanumea": "NMA",
		"Niutao": "NIT", 
		"Nui": "NUI",
		"Nukufetau": "NKF",
		"Nukulaelae": "NKL",
		"Vaitupu": "VAI",
		# Ex-ISO Code Aliases.
		"Nanumanga": "NMG",
	}
	def _populate_subdiv_fun_public_holidays(self):
		# Hurricane Bebe Day.
		self._add_holiday_oct_21(tr("Hurricane Bebe Day"))

	def _populate_subdiv_nmg_public_holidays(self):
		# Aho o te Fakavae.
		self._add_holiday_apr_15(tr("Aho o te Fakavae"))

	def _populate_subdiv_nma_public_holidays(self):
		# Te Po o Tefolaha.
		self._add_holiday_jan_8(tr("Te Po o Tefolaha"))

	def _populate_subdiv_nit_public_holidays(self):
		# Te Aso o te Setema.
		self._add_holiday_sep_17(tr("Te Aso o te Setema"))

	def _populate_subdiv_nui_public_holidays(self):
		# Bongin the Ieka.
		self._add_holiday_feb_16(tr("Bongin the Ieka"))

	def _populate_subdiv_nkf_public_holidays(self):
		# Te Aso O Tutasi.
		self._add_holiday_feb_11(tr("Te Aso O Tutasi"))
		
	def _populate_subdiv_nkl_public_holidays(self):
		# Aso o te Tala Lei.
		self._add_holiday_may_10(tr("Aso o te Tala Lei"))
	
	def _populate_subdiv_vai_public_holidays(self):
		# Te Aso Fiafia.
		self._add_holiday_nov_25(tr("Te Aso Fiafia"))

If the same holiday exists on multiple subdivisions, current USA implementation method can be done as well:

    def _populate_subdiv_holidays(self):
        # This section only matters if that country has other support categories.
        if PUBLIC not in self.categories:
            return None

        # Martin Luther King Jr. Day
        if self._year >= 1986 and self.subdiv not in {"AL", "AR", "AZ", "GA", "ID", "MS", "NH"}:
            self._add_holiday_3rd_mon_of_jan("Martin Luther King Jr. Day")

        # Washington's Birthday
        if self._year >= 1879 and self.subdiv not in {
            "AL",
            "AR",
            "DE",
            "FL",
            "GA",
            "IN",
            "NM",
            "PR",
            "VI",
        }:
            name = "Washington's Birthday"
            if self._year >= 1971:
                self._add_holiday_3rd_mon_of_feb(name)
            else:
                self._add_holiday_feb_22(name)

        # Columbus Day
        if self._year >= 1937 and (
            self.subdiv is None
            or self.subdiv
            in {
                "AS",
                "AZ",
                "CT",
                "GA",
                "ID",
                "IL",
                "IN",
                "MA",
                "MD",
                "MO",
                "MT",
                "NJ",
                "NY",
                "OH",
                "PA",
                "UT",
                "WV",
            }
        ):
            name = "Columbus Day"
            if self._year >= 1971:
                self._add_holiday_2nd_mon_of_oct(name)
            else:
                self._add_columbus_day(name)

        super()._populate_subdiv_holidays()

Your test case looks pretty much perfect here, though for holidays observed by multiple subdivisions in future implementations here's some examples from current Germany's test case:

    def test_heilige_drei_koenige(self):
        name = "Heilige Drei Könige"
        self.assertNoHolidayName(name)
        for subdiv, holidays in self.subdiv_holidays.items():
            if subdiv in {"BW", "BY", "ST"}:
                self.assertHolidayName(
                    name, holidays, (f"{year}-01-06" for year in range(1991, 2050))
                )
            else:
                self.assertNoHoliday(holidays, (f"{year}-01-06" for year in range(1991, 2050)))
                self.assertNoHolidayName(name, holidays)

@Prateekshit73
Copy link
Collaborator

I think I am done with the code. Should I open the pull request?

@PPsyrius
Copy link
Collaborator

@Prateekshit73 yes, you're free to do so 🙏

@Prateekshit73 Prateekshit73 mentioned this issue Feb 13, 2025
9 tasks
@Prateekshit73
Copy link
Collaborator

I need help. I tried this method :-

    def test_the_day_of_the_bombing(self):
        fun_holidays = Tuvalu(subdiv="FUN", years=range(1990, 2050))
        name = "Te Aso o te Paula"
        dt = (
            "2005-04-25",
            "2006-04-24",
            "2016-04-25",
            "2017-04-24",
            "2022-04-25",
        )

        for subdiv, holidays in self.subdiv_holidays.items():
            if subdiv == "FUN":
                self.assertHolidayName(
                    name, fun_holidays, (f"{year}-04-23" for year in range(1990, 2050))
                )
                self.assertHolidayName(f"{name} (fakamatakuga)", dt)
                self.assertNoNonObservedHoliday(dt)

I encountered this error :-

_____________________________________________________________________ TestTuvalu.test_the_day_of_the_bombing ______________________________________________________________________ 

self = <tests.countries.test_tuvalu.TestTuvalu testMethod=test_the_day_of_the_bombing>


    def test_the_day_of_the_bombing(self):
        fun_holidays = Tuvalu(subdiv="FUN", years=range(1990, 2050))
        name = "Te Aso o te Paula"
        dt = (
            "2005-04-25",
            "2006-04-24",
            "2016-04-25",
            "2017-04-24",
            "2022-04-25",
        )

        for subdiv, holidays in self.subdiv_holidays.items():
            if subdiv == "FUN":
                self.assertHolidayName(
                    name, fun_holidays, (f"{year}-04-23" for year in range(1990, 2050))
                )
>               self.assertHolidayName(f"{name} (fakamatakuga)", dt)

tests\countries\test_tuvalu.py:281:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests\common.py:200: in assertHolidayName
    self._assertHolidayName(name, "holidays", *args)
tests\common.py:192: in _assertHolidayName
    self.assertIn(name, holidays.get_list(dt), dt)
E   AssertionError: 'Te Aso o te Paula (fakamatakuga)' not found in [] : 2005-04-25

But Snapshot says :-

    "2005-04-23": "The Day of the Bombing",
    "2005-04-25": "The Day of the Bombing (observed)",

@KJhellico
Copy link
Collaborator

You don't have self._add_observed(...) for subsivisions holidays. And I'm not sure that it's needed there - we don't have any certain information that subdivisions' holidays are also postponed from weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants
0