date-holidays icon indicating copy to clipboard operation
date-holidays copied to clipboard

feat: add Norfolk Island

Open svict4 opened this issue 2 years ago • 6 comments

Norfolk Island is an external territory of Australia and votes for seats in the ACT, so I've added NF as a region of the ACT.

  • [x] fix Sovereign’s Birthday if already Bounty Day
  • [x] add tests

svict4 avatar Nov 25 '21 03:11 svict4

@commenthol One little quirk I'm unsure how to handle the following:

(g) Bounty Day—8 June and, if that day is a Saturday or Sunday, the next Monday; (h) Sovereign’s Birthday—the first Monday after the second Saturday in June or, if that Monday is observed as Bounty Day under paragraph (g), the next Monday;

It's as if I need a "not" condition on this: https://github.com/commenthol/date-holidays/blob/master/docs/specification.md#holiday-based-on-other-holidays-bridge-days

svict4 avatar Nov 25 '21 04:11 svict4

Hi @svit4,

Unfortunately there is no rule yet for "dynamic" bridge days as in your case. You describe the 2nd case to my knowledge which requires this behavior (CH-GL: Näfelser Fahrt would be the other one).

Would you mind adding a note like this here?

# TODO: needs new rule: "substitute 06-08 if Saturday, Sunday then next Monday if 2nd Monday in June then next Monday"

I was thinking that you can use the enable disable rule but it looks that there is a parser error which prevents evaluation to substitution days. Maybe you could create an issue in the parser project here.

The only thing (as a workaround) which comes to my mind would be setting hard dates. Albeit this will set 3 times Anniversary (Bounty) Day for those years.

like:

  "2013-06-17":
    name:
      en: Anniversary (Bounty) Day (substitute day)
    type: public
  "2030-06-17":
    name:
      en: Anniversary (Bounty) Day (substitute day)
    type: public

For "Queen's Birthday" I am wondering if acording to (h) the rule shouldn't be set to "2nd Saturday in June if Saturday then next Monday"? Would this apply to all Australian states/ regions?

commenthol avatar Nov 26 '21 18:11 commenthol

I don't think "Bounty Day" is the issue, that should simply be:

06-08 and if saturday,sunday then next monday:
  substitute: true
  name:
    en: Anniversary (Bounty) Day
  type: public

For "Queen's Birthday" I am wondering if acording to (h) the rule shouldn't be set to "2nd Saturday in June if Saturday then next Monday"? Would this apply to all Australian states/ regions?

For whatever reason, every state/region dictates when they celebrate the sovereign's birthday.

The problem here is that that "Queen's Birthday" moves a further week if it is already a public holiday on "he first Monday after the second Saturday in June", which would be due to Bounty Day.

We need something like:

# TODO: needs new rule: "substitute 2nd monday in June if Saturday, Sunday then next Monday if 2nd Monday in June is 'Bounty Day' then next Monday"

or

# TODO: needs new rule: "substitute 2nd monday in June if Saturday, Sunday then next Monday if 2nd Monday in June is holiday then next Monday"

svict4 avatar Jan 01 '22 14:01 svict4

Hi @svict4, At https://github.com/commenthol/date-holidays-parser/pull/42 I have added a new rule which should allow you to solve the described issue with moving a holiday if there is already a holiday the same day. Please let me know if this can solve your issue with "Bounty Day" and "Queen's Birthday" .

commenthol avatar Jan 03 '22 07:01 commenthol

Thanks @commenthol that works!

06-08 if saturday,sunday then next monday:
  substitute: true
  name:
    en: Anniversary (Bounty) Day
  type: public
monday after 2nd saturday in June if is public holiday then next monday:
  substitute: true
  name:
    en: Queen's Birthday

http://www.norfolkisland.gov.nf/sites/default/files/docs/NIRC/Gazettes/2018_06_29%20Gazette%20No.%2026.pdf

{
    "date": "2019-06-10 00:00:00",
    "start": "2019-06-09T14:00:00.000Z",
    "end": "2019-06-10T14:00:00.000Z",
    "name": "Anniversary (Bounty) Day",
    "type": "public",
    "rule": "06-08 if saturday,sunday then next monday",
    "_weekday": "Mon"
},
{
    "date": "2019-06-17 00:00:00",
    "start": "2019-06-16T14:00:00.000Z",
    "end": "2019-06-17T14:00:00.000Z",
    "name": "Queen's Birthday",
    "type": "public",
    "rule": "monday after 2nd saturday in June if is public holiday then next monday",
    "_weekday": "Mon"
}

I'll fix up the tests and publish the PR soon 🙂

svict4 avatar Jan 04 '22 06:01 svict4

Is there a way I can trigger the CI? @commenthol Looks like travis didn't pick up that I published this draft PR

svict4 avatar Jan 06 '22 01:01 svict4