GothenburgBitFactory / holidata

Holidata is the core of holidata.net, a no-nonsense, ad-free provider of international holiday data.
https://holidata.net
MIT License
43 stars 11 forks source link

Add locale for es-AR #42

Open cjbarroso opened 4 years ago

cjbarroso commented 4 years ago

We need the holiday locale for Argentina. You can find the goverment issued list of holidays and non-labourable days here. I can happily provide a script for scrap and convert to any format you need.

cjbarroso commented 4 years ago

A good source that answers all questions except the algorithms for calculations is this: https://www.lanacion.com.ar/feriados

lauft commented 4 years ago

Hello @cjbarroso,

I can happily provide a script for scrap and convert to any format you need.

To add this locale, we need the following:

With this data we can then flesh out the Locale

elamperti commented 3 years ago
  • Please provide a list of all holidays, i.e. days "which are defined by law on which business or work are suspended or reduced". Please also provide the legal source(s) which define these holidays.

Official list of holidays: https://www.argentina.gob.ar/interior/feriados

This list is defined during the previous year. It's different each year, as several holidays are moved around.

  • For each holiday
    • What is the official name?
    • Is it a regional or nation-wide holiday?

All holidays are nation-wide, although some of them are for certain religions (for the purposes of this API, if there's no way to mark them, they should be skipped).

  • If regional, what are the regions the holiday is observed in? (Note: currently only regions defined in ISO_3166-2 are supported)
  • Is it a fixed or variable date?

Some of them are variable dates.

  • If fixed, provide the date in format MM-DD
  • If a holiday has a variable date: What is the algorithm to calculate it? e.g.
    • nth / in
    • n days before/after easter
  • If it depends on the easter date: Is it the western or orthodox easter date?
  • If a holiday is proclaimed by the government: Please state the source.

All holidays in the site above are officially declared by the government.

  • Are holidays moved to a different date, e.g. if they fall on a saturday/sunday/...? If yes, which holidays and what is the algorithm?

There's no clear definition for it in this country, it depends on government definitions. Your best bet is to query the site and check where they land.

  • Are holidays observed on a different date (is there a substitute holiday), e.g. if they fall on a saturday/sunday/...? If yes, which holidays and what is the algorithm?

Some of them are.

  • Have there been any holidays renamed/deleted/created since 2011? If yes, which ones and since when?

They change every year.


@lauft I made a snippet to scrap the holiday list from the official site, although it's on js, I think you (or someone willing to create a PR in this repo!) may adapt it to what you need here: https://gist.github.com/elamperti/85a539d9b721cdb5dd5cf09f1f084398 (you may copy-paste the whole gist into your web browser's console in the official site and get an array with objects specifying date, holiday name and if it is fixed, variable or optional).

Feel free to add me as reviewer if needed in the PR for this locale.

lauft commented 3 years ago

@elamperti @cjbarroso The aim of holidata is not to scrape holiday dates from other websites and present them, but to algorithmically calculate the holiday dates based on the laws that define them. (Although it can use such data for cross-checking - see below)

The official site mentions Ley 27.399 (LAW ON THE ESTABLISHMENT OF HOLIDAYS AND LONG WEEKENDS) which lists the national immobile holidays and the national transfer holidays as well as the non working days and the rules for the long weekends. IMHO This is the point where we have to start from, translating the specifications mentioned in the law into the es-AR locale.

If you can provide the holiday data, preferrable for all years from 2011 to 2021, we can use it to create a test base and develop the locale against that, e.g.

2020-01-01 Año Nuevo
2020-02-24 Carnaval
2020-02-25 Carnaval
2020-03-23 Feriado Puente Turístico
2020-03-24 Día Nacional de la Memoria por la Verdad y la Justicia
2020-03-31 Día del Veterano y de los Caídos en la Guerra de Malvinas
2020-04-09 Jueves Santo
2020-04-10 Viernes Santo
2020-05-01 Día del Trabajador
2020-05-25 Día de la Revolución-05
2020-06-15 Paso a la Inmortalidad del Gral. Güemes
2020-06-20 Paso a la Inmortalidad del General Manuel Belgrano
2020-07-09 Día de la Independencia
2020-07-10 Feriado Puente Turístico
2020-08-17 Paso a la Inmortalidad del General José de San Martín
2020-10-12 Día del Respeto a la Diversidad Cultural
2020-11-23 Día de la Sobernía Nacional
2020-12-07 Feriado Puente Turístico
2020-12-08 Inmaculada Concepción de María
2020-12-25 Navidad
elamperti commented 3 years ago

@lauft I think you are underestimating the chaotic nature of argentinean politics: yes, there is a law to determine holidays, but it is modified from one year to other depending on political decisions. Bridge holidays depend on several (human) factors and weight of tourism, economy and education. Considering the impact of COVID-19 this year, I expect to see more changes for next year.

As I mentioned earlier, some of the dates are fixed (new year, christmas, independence day and a few others). Carnival days can be calculated based on easter (but bridge days around them will vary non-deterministically year to year). Other days won't be possible to calculate and, again, your best bet there will be to follow the official website.

Some holidays are recent, for example "Paso a la Inmortalidad del Gral. Güemes" was introduced in 2016, "Día de la Sobernía Nacional" was moved around in 2015. Flag day (20/jun) was declared a fixed-date holiday in 2017.

I wish it were as easy as creating a set of rules or just reading a law once, but it's a live and breathing beast.

If scraping is not an option, the locale should be maintained -at least- yearly to update dates, and considering how fast things have changed here before, the API couldn't be trusted. I don't know if there's a viable solution for this case.

lauft commented 3 years ago

@elamperti You are 100% right, but do not think I underestimate the task! 😉

Scraping is definitely not an option. Instead of just copying the dates from other sources, holidata goes back to the roots by incorporating the laws/decrees that define the holidays and reproduces the dates from there.

So I expected that there will be maintenance, as with every other locale. The trick is to keep it minimal.

So why doing the same process as the official site? For one scraping heavily depends on the API's stability and a website is definetly a live and breathing beast compared to standard interfaces (REST/SOAP/...) - and also those can be pretty nasty. So there is maintenance in any case... Also, this way holidata does not run the risk of being accused of plagiarism. Laws have to be publicly available by design - they are meant to be copied, so to say... 😄 (the case is different sometimes/in some countries with old/obsolete decrees, but that is another topic) Eventually, you will have to look at the laws in any case if you want to confirm that the output is correct, so why not do it in the first place? (And a benefit of relying on the laws as the source of truth is also this way holidata can always explain why date X is a holiday.)

A daring endeavour? Yes, indeed. Feasible? Let's take it step by step!

As proposed I would start with Ley 27.399. This gives the basis for 2017 and following. Article 6 defines the rule how the transferrable holidays have to be shifted, so we are good here. The tricky part comes with Article 7:

The national Executive Power may, in addition to what is established in the previous article, set annually up to three (3) holidays or non-working days destined to promote tourism, which must coincide with Monday or Friday. The national Executive Power must establish them fifty (50) days before the end of the calendar year.

Here we have to dig out all the decrees (like Decreto 717/2019) and incorporate them as well. And this will be be the regular maintenance task for this locale: Checking 50 days before the end of the calendar year for such a decree and encode into holidata.

For start we can focus on 2020, but holidata provides the data of all locales since 2011 and I would hate es-AR to be an exception.

Tinchops commented 3 years ago

Hi, I hope it helps to complete the data from 2011.

2011 - Source: Google New Year's Day Dec 31, 2010 – Jan 1, 2011 Shrove Monday Mon, Mar 7, 2011 Shrove Tuesday Tue, Mar 8, 2011 Day of Remembrance for Truth and Justice Mar 24 – 25, 2011 Malvinas Day Sat, Apr 2, 2011 Maundy Thursday Thu, Apr 21, 2011 Good Friday Fri, Apr 22, 2011 Labour Day Sun, May 1, 2011 First National Government Wed, May 25, 2011 Flag Day Mon, Jun 20, 2011 Argentina Independence Day Sat, Jul 9, 2011 Anniversary of the death of General José de San Martín Mon, Aug 15, 2011 Day of the Races Mon, Oct 10, 2011 National Sovereignty Day Mon, Nov 28, 2011 Feast of the Immaculate Conception Dec 8 – 9, 2011 Christmas Eve Sat, Dec 24, 2011 Christmas Day Sun, Dec 25, 2011 New Year's Day Dec 31, 2011 – Jan 1, 2012

2012 - Source: Google New Year's Day Dec 31, 2011 – Jan 1, 2012 Shrove Monday Mon, Feb 20, 2012 Shrove Tuesday Tue, Feb 21, 2012 Day of Remembrance for Truth and Justice Sat, Mar 24, 2012 Malvinas Day Mon, Apr 2, 2012 Maundy Thursday Thu, Apr 5, 2012 Good Friday Fri, Apr 6, 2012 Labour Day Tue, May 1, 2012 First National Government Fri, May 25, 2012 Flag Day Wed, Jun 20, 2012 Argentina Independence Day Mon, Jul 9, 2012 Anniversary of the death of General José de San Martín Mon, Aug 20, 2012 Day of the Races Mon, Oct 8, 2012 National Sovereignty Day Mon, Nov 26, 2012 Feast of the Immaculate Conception Sat, Dec 8, 2012 Christmas Eve Mon, Dec 24, 2012 Christmas Day Dec 24 – 25, 2012

2013 - Source: Google New Year's Day Tue, Jan 1, 2013 Shrove Monday Mon, Feb 11, 2013 Shrove Tuesday Tue, Feb 12, 2013 Day of Remembrance for Truth and Justice Sun, Mar 24, 2013 Maundy Thursday Thu, Mar 28, 2013 Good Friday Fri, Mar 29, 2013 Malvinas Day Apr 1 – 2, 2013 Labour Day Wed, May 1, 2013 First National Government Sat, May 25, 2013 Flag Day Thu, Jun 20, 2013 Argentina Independence Day Tue, Jul 9, 2013 Anniversary of the death of General José de San Martín Mon, Aug 19, 2013 Day of the Races Mon, Oct 14, 2013 National Sovereignty Day Mon, Nov 25, 2013 Feast of the Immaculate Conception Sun, Dec 8, 2013 Christmas Eve Tue, Dec 24, 2013 Christmas Day Wed, Dec 25, 2013 New Year's Day Dec 31, 2013 – Jan 1, 2014

2014 - Source: Google New Year's Day Dec 31, 2013 – Jan 1, 2014 Shrove Monday Mon, Mar 3, 2014 Shrove Tuesday Tue, Mar 4, 2014 Day of Remembrance for Truth and Justice Mon, Mar 24, 2014 Malvinas Day Wed, Apr 2, 2014 Maundy Thursday Thu, Apr 17, 2014 Good Friday Fri, Apr 18, 2014 Labour Day Thu, May 1, 2014 First National Government Sun, May 25, 2014 Flag Day Fri, Jun 20, 2014 Argentina Independence Day Wed, Jul 9, 2014 Anniversary of the death of General José de San Martín Mon, Aug 18, 2014 Day of the Races Mon, Oct 13, 2014 National Sovereignty Day Mon, Nov 24, 2014 Feast of the Immaculate Conception Mon, Dec 8, 2014 Christmas Eve Wed, Dec 24, 2014 Christmas Day Dec 25 – 26, 2014 New Year's Day Dec 31, 2014 – Jan 2, 2015

2015 - Source: Google New Year's Day Dec 31, 2014 – Jan 2, 2015 Shrove Monday Mon, Feb 16, 2015 Shrove Tuesday Tue, Feb 17, 2015 Day of Remembrance for Truth and Justice Mar 23 – 24, 2015 Malvinas Day Thu, Apr 2, 2015 Maundy Thursday Thu, Apr 2, 2015 Good Friday Fri, Apr 3, 2015 Labour Day Fri, May 1, 2015 First National Government Mon, May 25, 2015 Flag Day Sat, Jun 20, 2015 Argentina Independence Day Jul 9 – 10, 2015 Anniversary of the death of General José de San Martín Mon, Aug 17, 2015 Day of the Races Mon, Oct 12, 2015 National Sovereignty Day Mon, Nov 23, 2015 Feast of the Immaculate Conception Dec 7 – 8, 2015 Christmas Eve Thu, Dec 24, 2015 Christmas Day Fri, Dec 25, 2015

2016 - Source: Google New Year's Day Fri, Jan 1, 2016 Shrove Monday Mon, Feb 8, 2016 Shrove Tuesday Tue, Feb 9, 2016 Maundy Thursday Thu, Mar 24, 2016 Day of Remembrance for Truth and Justice Mar 24 – 25, 2016 Good Friday Fri, Mar 25, 2016 Malvinas Day Sat, Apr 2, 2016 Labour Day Sun, May 1, 2016 First National Government Wed, May 25, 2016 Anniversary of General Martín Miguel de Güemes' Death Fri, Jun 17, 2016 Flag Day Mon, Jun 20, 2016 Argentina Independence Day Jul 8 – 9, 2016 Anniversary of the death of General José de San Martín Mon, Aug 15, 2016 Day of the Races Mon, Oct 10, 2016 National Sovereignty Day Mon, Nov 28, 2016 Feast of the Immaculate Conception Dec 8 – 9, 2016 Christmas Eve Sat, Dec 24, 2016 Christmas Day Sun, Dec 25, 2016

2017 - Source: Google New Year's Day Sun, Jan 1, 2017 Shrove Monday Mon, Feb 27, 2017 Shrove Tuesday Tue, Feb 28, 2017 Day of Remembrance for Truth and Justice Fri, Mar 24, 2017 Malvinas Day Sun, Apr 2, 2017 Maundy Thursday Thu, Apr 13, 2017 Good Friday Fri, Apr 14, 2017 Labour Day Mon, May 1, 2017 First National Government May 25 – 26, 2017 Anniversary of General Martín Miguel de Güemes' Death Sat, Jun 17, 2017 Flag Day Tue, Jun 20, 2017 Argentina Independence Day Sun, Jul 9, 2017 Anniversary of the death of General José de San Martín Mon, Aug 21, 2017 Day of Respect for Cultural Diversity Mon, Oct 16, 2017 Bank Workers’ Day Mon, Nov 6, 2017 National Sovereignty Day Mon, Nov 20, 2017 Feast of the Immaculate Conception Fri, Dec 8, 2017 Christmas Eve Sun, Dec 24, 2017 Christmas Day Mon, Dec 25, 2017

2018 - Source: Google New Year's Day Mon, Jan 1, 2018 Shrove Monday Mon, Feb 12, 2018 Shrove Tuesday Tue, Feb 13, 2018 Day of Remembrance for Truth and Justice Sat, Mar 24, 2018 Maundy Thursday Thu, Mar 29, 2018 Good Friday Fri, Mar 30, 2018 Malvinas Day Mon, Apr 2, 2018 Labour Day Tue, May 1, 2018 First National Government Fri, May 25, 2018 Anniversary of General Martín Miguel de Güemes' Death Sun, Jun 17, 2018 Flag Day Wed, Jun 20, 2018 Argentina Independence Day Mon, Jul 9, 2018 Anniversary of the death of General José de San Martín Mon, Aug 20, 2018 Day of Respect for Cultural Diversity Mon, Oct 15, 2018 Bank Workers’ Day Tue, Nov 6, 2018 National Sovereignty Day Mon, Nov 19, 2018 Feast of the Immaculate Conception Sat, Dec 8, 2018 Christmas Eve Mon, Dec 24, 2018 Christmas Day Dec 24 – 25, 2018

2019 - Source: Google New Year's Day Tue, Jan 1, 2019 Shrove Monday Mon, Mar 4, 2019 Shrove Tuesday Tue, Mar 5, 2019 Day of Remembrance for Truth and Justice Sun, Mar 24, 2019 Malvinas Day Apr 1 – 2, 2019 Maundy Thursday Thu, Apr 18, 2019 Good Friday Fri, Apr 19, 2019 Labour Day Wed, May 1, 2019 First National Government Sat, May 25, 2019 Anniversary of General Martín Miguel de Güemes' Death Mon, Jun 17, 2019 Flag Day Thu, Jun 20, 2019 Argentina Independence Day Jul 8 – 9, 2019 Anniversary of the death of General José de San Martín Mon, Aug 19, 2019 Day of Respect for Cultural Diversity Mon, Oct 14, 2019 Bank Workers’ Day Wed, Nov 6, 2019 National Sovereignty Day Mon, Nov 18, 2019 Feast of the Immaculate Conception Sun, Dec 8, 2019 Christmas Eve Tue, Dec 24, 2019 Christmas Day Wed, Dec 25, 2019

2020 - Source: Google New Year's Day Wed, Jan 1, 2020 Shrove Monday Mon, Feb 24, 2020 Shrove Tuesday Tue, Feb 25, 2020 Day of Remembrance for Truth and Justice Mar 23 – 24, 2020 Malvinas Day Tue, Mar 31, 2020 Maundy Thursday Thu, Apr 9, 2020 Good Friday Fri, Apr 10, 2020 Labour Day Fri, May 1, 2020 First National Government Mon, May 25, 2020 Anniversary of General Martín Miguel de Güemes' Death Mon, Jun 15, 2020 Flag Day Sat, Jun 20, 2020 Argentina Independence Day Jul 9 – 10, 2020 Anniversary of the death of General José de San Martín Mon, Aug 17, 2020 Day of Respect for Cultural Diversity Mon, Oct 12, 2020 Bank Workers’ Day Fri, Nov 6, 2020 National Sovereignty Day Mon, Nov 23, 2020 Feast of the Immaculate Conception Dec 7 – 8, 2020 Christmas Eve Thu, Dec 24, 2020 Christmas Day Dec 24 – 25, 2020 New Year's Day Dec 31, 2020 – Jan 1, 2021

2021 - Source: Google New Year's Day Dec 31, 2020 – Jan 1, 2021 Shrove Monday Mon, Feb 15, 2021 Shrove Tuesday Tue, Feb 16, 2021 Day of Remembrance for Truth and Justice Wed, Mar 24, 2021 Maundy Thursday Thu, Apr 1, 2021 Good Friday Fri, Apr 2, 2021 Malvinas Day Fri, Apr 2, 2021 Labour Day Sat, May 1, 2021 First National Government Tue, May 25, 2021 Flag Day Sun, Jun 20, 2021 Anniversary of General Martín Miguel de Güemes' Death Mon, Jun 21, 2021 Argentina Independence Day Fri, Jul 9, 2021 Anniversary of the death of General José de San Martín Mon, Aug 16, 2021 Day of Respect for Cultural Diversity Mon, Oct 11, 2021 Bank Workers’ Day Sat, Nov 6, 2021 National Sovereignty Day Mon, Nov 22, 2021 Feast of the Immaculate Conception Wed, Dec 8, 2021 Christmas Eve Fri, Dec 24, 2021 Christmas Day Sat, Dec 25, 2021

Regards.

elamperti commented 3 years ago

Good luck trying to infer holidays from a law: just two weeks ago the government canceled a bridge holiday only to restore it 3 days before the actual date. It's a complete mess and just getting dates from laws is not feasible (just look at the holidays listed above). I do understand scrapping an official site is not the way holidata wants to handle it, but I see no other reliable way to do it really.

tbabej commented 3 years ago

I largely authored this Python-based algorithmic holiday generator so that this would not be needed, and hence I hate to suggest that, but maybe we could just create a Locale that has: