hebcal/hebcal-js

Daf Yomi: Hebcal reports Midot 34 as Tamid 34

Opened this issue · 2 comments

I think I may have found a bug in the naming of a particular daf in the daf yomi calculations.

Current Result

The following yields Tamid 34:

new Hebcal.HDate(new Date('2019-10-21 00:00:00')).dafyomi('h')

...as can be seen in this screenshot:

image

Expected

However, folio number 34 is actually the first daf of Midot, not the last of Tamid. Here's a link to that folio: http://hebrewbooks.org/pdfpager.aspx?req=37968&st=&pgnum=850

Looking at the daf yomi calendar, we can also see that they've labeled it as Midot:

image

I think the bug is here:

hebcal-js/src/dafyomi.js

Lines 120 to 132 in fcf7cbb

switch (count) {
case 36:
blatt = blatt + 21;
break;
case 37:
blatt = blatt + 24;
break;
case 38:
blatt = blatt + 33;
break;
default:
break;
}

For reference, here's a list of all the dafim according to the accepted Daf Yomi calendar (note that each folio is earmarked for the tractate with which it starts).

[
    {
        "name": "ברכות",
        "folios": 63,
        "starts_at": 2
    },
    {
        "name": "שבת",
        "folios": 156,
        "starts_at": 2
    },
    {
        "name": "עירובין",
        "folios": 104,
        "starts_at": 2
    },
    {
        "name": "פסחים",
        "folios": 120,
        "starts_at": 2
    },
    {
        "name": "שקלים",
        "folios": 21,
        "starts_at": 2
    },
    {
        "name": "יומא",
        "folios": 87,
        "starts_at": 2
    },
    {
        "name": "סוכה",
        "folios": 55,
        "starts_at": 2
    },
    {
        "name": "ראש השנה",
        "folios": 34,
        "starts_at": 2
    },
    {
        "name": "ביצה",
        "folios": 39,
        "starts_at": 2
    },
    {
        "name": "תענית",
        "folios": 30,
        "starts_at": 2
    },
    {
        "name": "מגילה",
        "folios": 31,
        "starts_at": 2
    },
    {
        "name": "מועד קטן",
        "folios": 28,
        "starts_at": 2
    },
    {
        "name": "חגיגה",
        "folios": 26,
        "starts_at": 2
    },
    {
        "name": "יבמות",
        "folios": 121,
        "starts_at": 2
    },
    {
        "name": "כתובות",
        "folios": 111,
        "starts_at": 2
    },
    {
        "name": "נדרים",
        "folios": 90,
        "starts_at": 2
    },
    {
        "name": "נזיר",
        "folios": 65,
        "starts_at": 2
    },
    {
        "name": "סוטה",
        "folios": 48,
        "starts_at": 2
    },
    {
        "name": "גיטין",
        "folios": 89,
        "starts_at": 2
    },
    {
        "name": "קידושין",
        "folios": 81,
        "starts_at": 2
    },
    {
        "name": "בבא קמא",
        "folios": 118,
        "starts_at": 2
    },
    {
        "name": "בבא מציעא",
        "folios": 118,
        "starts_at": 2
    },
    {
        "name": "בבא בתרא",
        "folios": 175,
        "starts_at": 2
    },
    {
        "name": "סנהדרין",
        "folios": 112,
        "starts_at": 2
    },
    {
        "name": "מכות",
        "folios": 23,
        "starts_at": 2
    },
    {
        "name": "שבועות",
        "folios": 48,
        "starts_at": 2
    },
    {
        "name": "עבודה זרה",
        "folios": 75,
        "starts_at": 2
    },
    {
        "name": "הוריות",
        "folios": 12,
        "starts_at": 2
    },
    {
        "name": "זבחים",
        "folios": 119,
        "starts_at": 2
    },
    {
        "name": "מנחות",
        "folios": 109,
        "starts_at": 2
    },
    {
        "name": "חולין",
        "folios": 141,
        "starts_at": 2
    },
    {
        "name": "בכורות",
        "folios": 60,
        "starts_at": 2
    },
    {
        "name": "ערכין",
        "folios": 33,
        "starts_at": 2
    },
    {
        "name": "תמורה",
        "folios": 33,
        "starts_at": 2
    },
    {
        "name": "כריתות",
        "folios": 27,
        "starts_at": 2
    },
    {
        "name": "מעילה",
        "folios": 21,
        "starts_at": 2
    },
    {
        "name": "קנים",
        "folios": 3,
        "starts_at": 23
    },
    {
        "name": "תמיד",
        "folios": 8,
        "starts_at": 26
    },
    {
        "name": "מדות",
        "folios": 4,
        "starts_at": 34
    },
    {
        "name": "נדה",
        "folios": 72,
        "starts_at": 2
    }
]

This can be fixed by setting

blatt = blatt + 33;

to blatt = blatt + 32;

and

hebcal-js/src/dafyomi.js

Lines 71 to 72 in fcf7cbb

[ "Tamid", 0, "תמיד", 10 ],
[ "Midot", "Midos", "מדות", 4 ],

Should be changed to
Tamid to 9 instead of 10

[ "Tamid",          0,                  "תמיד",          9],

And while you are there you can fix Midos to 5 so that Niddah can start on the same date

[ "Midot",          "Midos",            "מדות",          5   ],