holidata icon indicating copy to clipboard operation
holidata copied to clipboard

Issue #94: Created SG.py (This is a file that handles functionality for the Singapore locale)

Open nathanielmiller23 opened this issue 1 year ago • 1 comments

This issue came from here: https://github.com/GothenburgBitFactory/holidata/issues/94

What I did:

  • I implemented a file, SG.py to handle the functionality for Singaporean holidays to be used in holidata.
  • For holidays occurring on the same day, I was simply able to use the link referred to by the issue creator: https://www.mom.gov.sg/employment-practices/public-holidays
  • For holidays with variable dates, I hardcoded them, dating back to the year 2011, which is the earliest year for which holidata provides data. The hardcoded dates contain data up until the year 2026 and would likely need to be updated at a later date. From one of my sources:

A majority of the holidays celebrated in Singapore are based on different religious beliefs. Many of these holidays occur on different dates each year because they are based on different calendars and the lunar cycle. The Ministry of Manpower will release the official holiday dates towards the end of each year for the following year.

Christian holidays that use the lunar cycle are based off of the Gregorian calendar. Muslim holidays based off of the lunar cycle in Singapore are calculated by the Majlis Ugama Islam lunar visibility criteria. Hindu holidays are based off of the Hindu lunar calendar. If more than one holiday occurs on the same date because of lunar calculations, an additional holiday is given to replace it and to eliminate “bad luck.”

With this in mind, hard-coding certain holidays for the Singapore locale will likely be a necessity.

Sources:

  • https://www.mom.gov.sg/employment-practices/public-holidays
  • https://publicholidays.sg/

nathanielmiller23 avatar Aug 04 '24 01:08 nathanielmiller23

@nathanielmiller23 I have dropped the dependency to snapshottest in favor of syrupy; the latter seems better maintained and already supports Python 3.12.

This makes it mandatory to rebase your PR before adding the snapshot files for your locale.

lauft avatar Aug 17 '24 20:08 lauft