0
Answered

Create a query to determine whether today is yomtov or shabbat

CAA 1 year ago updated by Michael J. Radwin 1 year ago 1

Hi, We're making a process in Zapier that needs to abort if it's yomtov to avoid sending out messages when it isn't appropriate. Is there a way to generate RSS or JSON which we can then parse with Zapier to see whether today is yomtov? At the moment I can only see ways to generate lists for a whole month or year?

Answer

Answer
Answered

Hi, thanks for using Hebcal.

You should be able to do this using our Jewish Calendar API by setting the start and end parameters to be today's date in YYYY-MM-DD format, and setting maj=on for only major holidays. Then, you'll need to see if items is empty - and if it's not, check to see if the object inside contains yomtov: true.

For example, here's the second day of Pesach in the Diaspora:

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-03-29&end=2021-03-29

{
  "title": "Hebcal Diaspora March 2021",
  "date": "2021-02-08T00:07:43.224Z",
  "location": {
    "geo": "none"
  },
  "items": [
    {
      "title": "Pesach II",
      "date": "2021-03-29",
      "category": "holiday",
      "subcat": "major",
      "yomtov": true,
      "hebrew": "פסח יום ב׳",
      "link": "https://www.hebcal.com/holidays/pesach-2021?utm_source=js&utm_medium=api",
      "memo": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt"
    }
  ]

And here's an example of non-yomtov - Chol haMoed Sukkot

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-09-24&end=2021-09-24

{
  "title": "Hebcal Diaspora September 2021",
  "date": "2021-02-08T00:11:48.425Z",
  "location": {
    "geo": "none"
  },
  "items": [
    {
      "title": "Sukkot IV (CH''M)",
      "date": "2021-09-24",
      "category": "holiday",
      "subcat": "major",
      "hebrew": "סוכות יום ד׳ (חול המועד)",
      "link": "https://www.hebcal.com/holidays/sukkot-2021?utm_source=js&utm_medium=api",
      "memo": "Feast of Booths"
    }
  ]
}

If you pick a day that has no major holidays, you'll get an empty items array:

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-06-01&end=2021-06-01

{
  "title": "Hebcal Diaspora 2021",
  "date": "2021-02-08T00:13:45.611Z",
  "location": {
    "geo": "none"
  },
  "items": []
}

Answer
Answered

Hi, thanks for using Hebcal.

You should be able to do this using our Jewish Calendar API by setting the start and end parameters to be today's date in YYYY-MM-DD format, and setting maj=on for only major holidays. Then, you'll need to see if items is empty - and if it's not, check to see if the object inside contains yomtov: true.

For example, here's the second day of Pesach in the Diaspora:

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-03-29&end=2021-03-29

{
  "title": "Hebcal Diaspora March 2021",
  "date": "2021-02-08T00:07:43.224Z",
  "location": {
    "geo": "none"
  },
  "items": [
    {
      "title": "Pesach II",
      "date": "2021-03-29",
      "category": "holiday",
      "subcat": "major",
      "yomtov": true,
      "hebrew": "פסח יום ב׳",
      "link": "https://www.hebcal.com/holidays/pesach-2021?utm_source=js&utm_medium=api",
      "memo": "Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt"
    }
  ]

And here's an example of non-yomtov - Chol haMoed Sukkot

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-09-24&end=2021-09-24

{
  "title": "Hebcal Diaspora September 2021",
  "date": "2021-02-08T00:11:48.425Z",
  "location": {
    "geo": "none"
  },
  "items": [
    {
      "title": "Sukkot IV (CH''M)",
      "date": "2021-09-24",
      "category": "holiday",
      "subcat": "major",
      "hebrew": "סוכות יום ד׳ (חול המועד)",
      "link": "https://www.hebcal.com/holidays/sukkot-2021?utm_source=js&utm_medium=api",
      "memo": "Feast of Booths"
    }
  ]
}

If you pick a day that has no major holidays, you'll get an empty items array:

http://hebcal.com/hebcal?cfg=json&v=1&maj=on&leyning=off&start=2021-06-01&end=2021-06-01

{
  "title": "Hebcal Diaspora 2021",
  "date": "2021-02-08T00:13:45.611Z",
  "location": {
    "geo": "none"
  },
  "items": []
}