Repository navigation
Keep every Daf Yomi Yerushalmi daf and give the molad of Teves 3761 - #297
Merged
KosherJava merged 1 commit intoOct 23, 2026
Merged
Conversation
A Yom Kippur or Tisha B'Av on the first day of a cycle extension was not counted, so the Yerushalmi cycle ending in 2172 lost Niddah 13. isBetween now includes the start date. The molad of Teves 3761 is on 12 December 0000, which setAbsDate rejected. setAbsDate now accepts it, and setGregorianDate and minusDays keep the check. gregorianDateToAbsDate, absDateToDate and the day of the week use floor division so year 0 gets its leap day and the right weekday.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bugs
Daf Yomi Yerushalmi skips a daf. When a cycle is extended for Yom Kippur or Tisha B'Av, a skip day that falls on the first day of the extension is not counted, so the cycle ends a day early and loses its last daf. The first such cycle ends in 2172. On 7 August 2172
getDafYomiYerushalmireturns Berachos 1 instead of Niddah 13, so Niddah 13 is never learned. Later dates are off too: 2 November 2203 gives Shabbos 75 instead of 74. The cycle ending in August 2480 loses a daf the same way.The molad of Teves 3761 throws.
getMolad()andgetMoladAsInstant()throw "Dates in the BC era are not supported" for 18 to 29 Teves 3761, the first dates aJewishDateaccepts. That molad is on Tuesday 12 December of year 0, before 1 January 0001.Why
YerushalmiYomiCalculator.isBetweencounts Yom Kippur and Tisha B'Av after the start of the range, not on it.getNextCycleStartextends a cycle by counting skip days from the day after the previous end, so a skip day on that first day is missed.getDafYomiYerushalmicounts skip days from the start of the cycle in the same way.JewishDate(long molad)goes throughsetAbsDate, which rejects any date before 1 January 0001. Letting the date through is not enough on its own, because three calculations assume a positive absolute date.gregorianDateToAbsDatecounts leap days with/, which rounds toward zero. For year 0 that misses its leap day, so every date in year 0 comes out a day late, andabsDateToDatereturns the day before.absDateToDatestarts its search atabsDate / 366.Math.abs(absDate % 7) + 1, which gives Friday for 12 December 0000 instead of Tuesday.The fix
isBetweenincludes the start date. The Javadoc says why.setAbsDateaccepts any absolute date. The check for dates before 1 January 0001 moved tosetGregorianDateandminusDays, the two places a caller's date can fall before it, so they throw as before.plusDaysonly moves forward andclonecopies an existing date.gregorianDateToAbsDateandabsDateToDateuseMath.floorDiv, and the day of the week usesMath.floorMod. For every date from 1 January 0001 on, the results are the same as before.Testing
UT_YerushalmiTest.testCycleExtendedForTishaBavchecks 6 to 8 August 2172. It fails without the fix ("2172-08-07 expected:<38> but was:<0>") and passes with it.UT_YerushalmiTest.testCycleWithTishaBavBeforeItsLastDafchecks 14 to 17 August 2480. It fails without the fix and passes with it.UT_JewishDateNavigation.moladInGregorianYear0checks the date, day of the week, hours, minutes and chalakim of the molad of Teves 3761. It throws without the fix and passes with it.