Skip to content

Commit

Permalink
Add HDate.tachanun_uf() function
Browse files Browse the repository at this point in the history
Show tachanun in a user-friendly manner
  • Loading branch information
Scimonster committed May 17, 2017
1 parent 37a67fe commit aa6e0eb
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 11 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ new Hebcal.HDate(15, 'elul', 5772).dafyomi('a') // Berachos 30

### `Hebcal.HDate.prototype.tachanun()`

Return a bitmask containing information on what Tachanun (or Tzidchatcha on Shabbat) is said on that day.
Return a bitmask containing information on what Tachanun (or Tzidchatcha on Shabbat) is said on that day. For an explanation of how this works, see [issue #38](https://github.com/hebcal/hebcal-js/issues/38#issuecomment-300735615).

Tachanun is not said on Rosh Chodesh, the month of Nisan, Lag Baomer, Rosh Chodesh Sivan until Isru Chag, Tisha B'av, 15 Av, Erev Rosh Hashanah, Rosh Hashanah, Erev Yom Kippur until after Simchat Torah, Chanukah, Tu B'shvat, Purim and Shushan Purim, and Purim and Shushan Purim Katan.

Expand All @@ -984,6 +984,20 @@ These bitmasks are also available as properties of the function:

However, due to the lengthliness of typing `Hebcal.HDate.prototype.tachanun.*BITMASK*`, it may be easier to just use the values directly.

### `Hebcal.HDate.prototype.tachanun_uf()`

*New as of v2.2.4*

Return a user-friendly representation of tachanun(). An object with Boolean properties {shacharit, mincha, all_congs}.

```js
new Hebcal.HDate('1 Tishrei').tachanun_uf() // { shacharit: false, mincha: false, all_congs: false }
new Hebcal.HDate('25 Tishrei').tachanun_uf() // { shacharit: true, mincha: true, all_congs: false }
new Hebcal.HDate('6 Cheshvan').tachanun_uf() // { shacharit: true, mincha: true, all_congs: true }
new Hebcal.HDate().onOrAfter(5).tachanun_uf() // Friday: { shacharit: true, mincha: false, all_congs: true }
new Hebcal.HDate().onOrAfter(6).tachanun_uf() // Shabbat: { shacharit: false, mincha: true, all_congs: true }
```

### `Hebcal.HDate.prototype.hallel()`

Return a number containing information on what Hallel is said on that day.
Expand Down
9 changes: 9 additions & 0 deletions client/hebcal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/hebcal.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/hebcal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/hebcal.min.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions client/hebcal.noloc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client/hebcal.noloc.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/hebcal.noloc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/hebcal.noloc.min.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions hebcal.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,15 @@ HDateProto.tachanun = (function() {
return tachanun;
})();

HDateProto.tachanun_uf = function(){
var ret = this.tachanun();
return {
shacharit: !!(ret & this.tachanun.SHACHARIT),
mincha: !!(ret & this.tachanun.MINCHA),
all_congs: !!(ret & this.tachanun.ALL_CONGS)
};
};

HDateProto.hallel = (function() {
var NONE = hallel.NONE = 0,
HALF = hallel.HALF = 1,
Expand Down

0 comments on commit aa6e0eb

Please sign in to comment.