Skip to content
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

Add locale for et-EE #47

Closed
sturmer opened this issue Jun 13, 2020 · 4 comments
Closed

Add locale for et-EE #47

sturmer opened this issue Jun 13, 2020 · 4 comments
Labels

Comments

@sturmer
Copy link

sturmer commented Jun 13, 2020

Hi! I live in the beautiful Estonia and started using Timewarrior. It'd be great to have holiday data for this country.

@lauft
Copy link
Member

lauft commented Jun 15, 2020

Hi!

Adding a locale requires a list of all public holidays, i.e. days "which are defined by law on which business or work are suspended or reduced". To get this started, please provide the online sources of the legal documents which define the holidays.

If you want to help:

  • Gather a list of all public holidays, i.e. days "which are defined by law on which business or work are suspended or reduced" from the source.

  • Now for each holiday:

    • Has it a fixed or variable date?
    • What is the official name (as written in the legal source/calendar)?
    • Is it a regional or nation-wide holiday?
    • If regional, what are the regions the holiday is observed in? (Note: currently only regions defined in ISO_3166-2 are supported)
    • If the holiday date is variable, what is the algorithm to calculate the date? This could be something like "X days before/after easter", "nth (week)day of month", ...
    • Is the holiday observed on a different date or is there a substitute holiday if it falls on a saturday/sunday/...
  • Since holidata provides data since 2011 it would be helpful to know whether a holiday has been renamed/deleted/created since 2011

If you want to contribute a PR:

Create a file et-EE.py in holidata/holidays, enter the new locale et-EE in the list of locales in the __init__.py in the same directory.

Within et-EE.py create a class and the following skeleton:

# coding=utf-8
from dateutil.easter import EASTER_WESTERN

from .holidays import Locale


class et_EE(Locale):
    """
    """

    locale = "et-EE"
    easter_type = EASTER_WESTERN

For each holiday with a fixed date add a line in the following format within the class doc (between the triple-quotes):

  • for regional holidays MM-DD: [<regions>] [<flags>] <name>
  • for nation-wide holidays: MM-DD: [<flags>] <name>

The relevant flags here are F for fixed date and N for national (all regions) and R for religious (e.g. christmas, church holidays). The [<regions>] has to be omitted if it is a nation-wide holiday.

For each holiday holiday with a variable date:

  • If it depends on the easter date, add a line in the following format within the class doc:
    n days (before|after) Easter: [<regions>] [<flags>] <name>
    (for Easter, Easter: ... suffices)
  • If the holiday is held on a specific weekday, add a line in the following format:
    nth. (last)? <weekday> in <month>: [<regions>] [<flags>] <name>
    e.g. 1. monday in august or 2. last saturday in may

Also here the [<regions>] has to be omitted if it is a nation-wide holiday.

If a holiday has a variable date that cannot be covered by the patterns above, add a function holiday_<holiday_name_in_snake_case> to the class. The function must return a List[Holiday]. See the other locales for examples. Such a function is required e.g. if

  • a holiday is proclaimed by the government
  • a holiday is moved to a different date, if they fall on a saturday/sunday/...?
  • a holiday is observed on a different date or there is a substitute holiday when they fall on a saturday/sunday/...
  • a holiday has been renamed/deleted/created since/after 2011

@lauft lauft changed the title Add locale for Estonia Add locale for et-EE Jun 15, 2020
@lauft lauft added the help wanted Extra attention is needed label Jun 15, 2020
@lauft lauft added the locale label Jun 19, 2020
@h0adp0re
Copy link

Hello, I can help a little in this regard. I don't think I have time to contribute code but here's our law with all our public holidays and other important dates: https://www.riigiteataja.ee/en/eli/ee/525062018003/consolide/current

@lauft
Copy link
Member

lauft commented Jan 12, 2022

@h0adp0re I have added PR #81 for this. Could you take a look and help to resolve the open questions there?

lauft added a commit that referenced this issue Jan 14, 2022
Closes #81
Closes #47

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
@lauft lauft closed this as completed in 1656dcd Jan 14, 2022
@lauft lauft removed the help wanted Extra attention is needed label Jan 14, 2022
@lauft
Copy link
Member

lauft commented Jan 14, 2022

@sturmer, @h0adp0re the locale et-EE is now available on holidata.net. 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants