scorpionmit01 / homebridge-jewish-calendar

Homebridge Plugin that provides contact sensors related to the Jewish Calendar.
MIT License
3 stars 3 forks source link

Israeli independence day #10

Open Aransh opened 1 year ago

Aransh commented 1 year ago

Hey! Just discovered this plugin, absolutely love it! Thank you 😇 I know it isn't a religious holiday by any means, but Israeli independence day is the only Holiday/vacation that is celebrated by Hebrew date that I can think of that is not on this plugin's list. I would really appreciate if it can be added 🙏🏼 maybe as an optional setting.

If you do end up adding support, please take these rules into account:

scorpionmit01 commented 1 year ago

I thought about it when I built the plugin. I'll be the first to admit that when I build it, I didn't want to take the time to figure out how to make the date rules work in the structure I built the plugin.

Full disclosure, I was learning NodeJS while I built the plugin.

Hopefully, this summer, I'll have some time to loop back into the project. Once I do that, it's pretty straight forward.

The calendar doesn't "know dates" it just just "Is it this day of the Hebrew calendar." So the rules would have to be:

I think it's Israel Independence Day if: Iyar 3 AND Wednesday AND after Sundown or Iyar 3 and Thursday AND before Sundown or Iyar 4 and Thursday AND before Sundown or Iyar 5 AND Monday AND after sundown or Iyar 6 AND Tuesday AND before sundown

Does that logic fly?

If so, adding Yom Hazikaron is pretty easy, exact same rules one day earlier.

On Sat, Apr 29, 2023 at 6:52 PM Aran Shavit @.***> wrote:

Hey! Just discovered this plugin, absolutely love it! Thank you 😇 I know it isn't a religious holiday by any means, but Israeli independence day is the only Holiday/vacation that is celebrated by Hebrew date that I can think of that is not on this plugin's list. I would really appreciate if it can be added 🙏🏼 maybe as an optional setting.

If you do end up adding support, please take these rules into account:

  • Israeli independence day is on the Fifth of Iyar.
  • If this is a Friday or Saturday, it will be celebrated earlier, on Thursday.
  • If this is a Monday, it will be celebrated later, on Tuesday.

— Reply to this email directly, view it on GitHub https://github.com/scorpionmit01/homebridge-jewish-calendar/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYN4VMJII64ILR7D5EJGHLXDWLSRANCNFSM6AAAAAAXQP4IIY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Book a meeting with me @.***>

Aransh commented 1 year ago

I'm not sure the logic tracks (but will admit it got me a bit confused) Also small detail, according to the Hebrew calendar, Iyar 5 can only occur on Monday, Wednesday, Friday or Saturday, so this simplifies it a bit.

If I understand you correctly (and also taking into account the fact the holiday starts at sundown the previous day) the correct logic will be if: # If Iyar 5 is on Wednesday (normal) { Iyar 4 And Tuesday AND after sundown or Iyar 5 AND Wednesday AND before sundown } or # If Iyar 5 is on Friday { Iyar 3 AND Wednesday AND after sundown or Iyar 4 AND Thursday AND before sundown } or # If Iyar 5 is on Saturday { Iyar 2 AND Wednesday AND after sundown or Iyar 3 AND Thursday AND before sundown } or # If Iyar 5 is on Monday { Iyar 5 AND Monday AND after sundown or Iyar 6 AND Tuesday AND before sundown }

Basically for the day itself we have 4 options: If Iyar 5 is on Thursday, all is ok If Iyar 5 is on Friday, it will be on Iyar 4 If Iyar 5 is on Saturday, it will be on Iyar 3 If Iyar 5 is on Monday, it will be on Iyar 6

Adding the night before, after sundown, to each of these = 8 scenarios where independence day=true :)

Also, adding Yom Hazikaron sounds great Thank you for your comment