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 ja-JP #16

Open lauft opened 4 years ago

lauft commented 4 years ago

The following locale needs to be verified/completed:

class ja_JP(Locale):
    """
    01-01: [NF] 元日
    02-11: [NF] 建国記念の日
    04-29: [NF] 昭和の日
    05-03: [NF] 憲法記念日
    05-04: [NF] みどりの日
    05-05: [NF] こどもの日
    11-03: [NF] 文化の日
    11-23: [NF] 勤労感謝の日
    12-23: [NF] 天皇誕生日
    : [NV] 成人の日
    : [NV] 春分の日
    : [NV] 海の日
    : [NV] 敬老の日
    : [NV] 秋分の日
    : [NV] 体育の日
    """

    locale = "jp-JP"

Checklist:

omasanori commented 2 years ago

I would like to help 😃 I will collect the source and so on later, but I have some questions and comments:

locale = "jp-JP"

Isn't this ja-JP? Also, can we provide en-JP too?

Are the fixed dates - correct?

Some holidays had moved temporally, 天皇誕生日 (Emperor's Birthday) is the reigning Emperor's birthday so it has moved from time to time, and so on. Are they representable?

If a holiday has a variable date: Is the algorithm to calculate it correct/can you provide it if missing?

Most of them are "the second Monday in January" or such. 春分の日 and 秋分の日 are tricky, as it is not the easter but depend on the equinox in March and September.

Are holidays moved to a different date, e.g. if they fall on a saturday/sunday/...? Are holidays observed on a different date (is there a substitute holiday), e.g. if they fall on a saturday/sunday/...?

Schools, companies, and so on would have non-working days on the nearest non-holiday if they fall on a Sunday. However, the date of holidays on the calendar will not move. Does it count as a substitute holiday?

Are the flags correct? (N = national holiday, defined by law, R = holiday with religious background, F = holiday with fixed date, V = holiday with variable date)

Can a holiday be both N and R? Otherwise, N is defined as non-R holidays?

lauft commented 2 years ago

Isn't this ja-JP?

Yes, you are correct, I fixed the error in the description. 👍🏻

Also, can we provide en-JP too?

Yes, of course – if you can provide the translation.

Some holidays had moved temporally, 天皇誕生日 (Emperor's Birthday) is the reigning Emperor's birthday so it has moved from time to time, and so on. Are they representable?

Holidata provides data from 2011, so we only need to consider the emperors' birthdays since then.

If this should change, Holidata needs to reflect this of course. There are several ways to do this: either implement a function for each emperor which provides the holiday for the given time range (open ended for the current one) or implement a single function which provides the holiday at the respective date for the given year. I would opt for the one-emperor-one-function approach, as it provides a clearer encapsulation of the specific holiday.

Most of them are "the second Monday in January" or such. 春分の日 and 秋分の日 are tricky, as it is not the easter but depend on the equinox in March and September.

If there is an algorithm to calculate the date of the equinox (just like the easter algorithm) then we can use this one. Otherwise, the equinoxes/dates have to be defined somewhere beforehand, so we have to implement (and regularly update) this table then.

Schools, companies, and so on would have non-working days on the nearest non-holiday if they fall on a Sunday. However, the date of holidays on the calendar will not move. Does it count as a substitute holiday?

For most countries Holidata implements them as <name> (substitute) or similar. I would try to name the substitue holiday the same as it would show up in the respective calendar.

Can a holiday be both N and R? Otherwise, N is defined as non-R holidays?

Note: N is for national, R is for religious (not 'regional').

The opposite of both flags is simply to leave them out. A non-national holiday however must have regions specified (a national holiday, on the other hand, must have no regions specified).

The purpose 'religious' flag is not quite defined. Currently it is used to mark holidays with a religious background.

omasanori commented 2 years ago

Thank you for answering! I think I got enough information to collect data, but I may ask again if not.

Yes, you are correct, I fixed the error in the description. 👍🏻

Thanks!

Yes, of course – if you can provide the translation.

OK, I would.

Holidata provides data from 2011, so we only need to consider the emperors' birthdays since then.

I see.

If there is an algorithm to calculate the date of the equinox (just like the easter algorithm) then we can use this one. Otherwise, the equinoxes/dates have to be defined somewhere beforehand, so we have to implement (and regularly update) this table then.

A table would be better, as they are officially declared in February of the previous year based on astronomical observation. You can calculate estimated equinoxes in Japan, however.

For most countries Holidata implements them as <name> (substitute) or similar. I would try to name the substitute holiday the same as it would show up in the respective calendar.

OK.

Note: N is for national, R is for religious (not 'regional').

Yes, I meant that equinoxes are national holidays defined by law but on the other hand, religious festivals occur on these holidays. Thus, I wonder if religious events are not counted as national events.

omasanori commented 2 years ago

Some updates:

The table of holidays in CSV by the Cabinet Office of Japan is available at: https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv (Note that the encoding is not UTF-8 but Shift_JIS.)

The canonical source of holidays is 国民の祝日に関する法律. As far as I know, translations of this act are not provided officially.