When was Dovid Hamelech niftar? See Gemara Shabbos [30a]: Rav Yehudah says in the name of Rav: The passuk records Dovid’s request [Tehillim 39:5], ‘Inform me, Hashem, when I will die…’ Hashem answers that there is a decree not to reveal such information. Though exact information is unavailable, Dovid is told that he will die on Shabbos. Presumably, this nevuah is fulfilled and Dovid dies on Shabbos.
However, we see differently elsewhere. The Gemara [Chagigah 17a] discusses whether there is a full week given to bring the korbon chagigah of Shavuos. Tosafos there brings a proof from the Yerushalmi that the chagigah can be brought after Yom Tov. The Yerushalmi says that Dovid was niftar on Shavuos so everyone delayed bringing their chagigah until the next day. Rabbeinu Elchanan questions the Yerushalmi. We have learned from the Gemara in Shabbos that Dovid Hamelech was niftar on Shabbos. If so, Shabbos is itself a reason to delay the chagigah even if Dovid doesn’t die. The Tosafos gives an amazing answer: perhaps the Yerushalmi disagrees, maintaining that Dovid did not die on Shabbos. So it comes out that the Yerushalmi explicitly holds that Dovid was niftar on Shavuos. According to Tosafos’ understanding of the Yerushalmi, Dovid was not niftar on Shabbos. The Gemara in Shabbos is not explicit if the Shabbos when Dovid was niftar was or was not Shavuos.
Midrash Rabbah [Rus 3:2] is explicit that Dovid Hamelech was niftar on Shavuos that came out on Shabbos. This position is consistent with the Gemara in Shabbos and the Yerushalmi, but not according to Tosafos’ understanding of the Yerushalmi. We also remain with Tosafos’ question on the Yerushalmi: Why say that due to Dovid Hamelech’s petirah they did not bring their chagigah on Shavuos? Behold, it was Shabbos that Shavuos and one never brings the chagigah on Shabbos!
Why not push off the question and say: “The Yerushalmi means that they were overwhelmed by the petirah of Dovid Hamelech but really, since it was Shabbos, they were not trying to bring their chagigah”? This is an injustice to both the words of the Yerushalmi and the light of understanding that has been shed by the question of Rabbeinu Elchanan of Tosafos. To push further and suggest, without proof, that maybe Dovid Hamelech was niftar before the beginning of the korbanos-day in the Beis Hamikdash and therefore they were already onenim before the dinei Shabbos could prevent them from bringing the korban chagigah. Such an answer reveals a fundamental lack of understanding. Obviously, onen is a din in the hakravas hakorban, whereas Shabbos is a din that prevents the hakravah of the chagigah upon the commencement of Shabbos. Even if due to other dinei korban they were not going to bring their chagigah at night, yet the dinei Shabbos already, ab–initio, prevent one from bringing the chagigah — as Rabbeinu Elchanan has asked. We will have to leave this question unanswered.
We also have another, fundamental question on the Midrash Rabbah. There is a principle “lo bd”u Pesach.” [See Rosh Hashanah 20a and Yerushalmi Sukkah 4:1.] This means that when setting up the calendar, care is taken so that Pesach will not begin on a Monday, Wednesday or Friday. When this rule is followed, Shavuos, which is 50 days after the second day of Pesach, will never be on Shabbos. How could Dovid Hamelech die on Shavuos that came out on Shabbos if this is never meant to happen due to this rule of the calendar?
One answer is from the Sefer Ha’ibbur. He states explicitly that this rule of when Pesach falls is only when we have a fixed, calculated calendar. But when the Sanhedrin sanctified the new moon based on testimony, like in the times of Dovid Hamelech, this rule of the calendar did not yet exist. This is the position of the Rambam [Hilchos Kiddush Hachodesh Ch. 7] and Rashi [Pesachim 58b].
This position is somewhat controversial with Rabbeinu Bachya [Parashas Bo] quoting Rabbeinu Chananel that the rule of “lo bd”u Pesach” is a halachah l’Moshe miSinai. This is also the position of Rav Saadiah Gaon. This position is based on the assumption that even when Sanhedrin would declare the new month based on witness testimony, the decision was really based on the calculations — just like we do nowadays when there is no Sanhedrin to accept witnesses.
Tosafos [Pesachim 58b] argues that even when the new moon was sanctified based on witnesses, the rule of “lo bd”u Pesach” was followed. Perhaps this is due to the aforementioned understanding of Rabbeinu Chananel. If so, how could the Midrash Rabbah above state that Shavuos occurred on Shabbos?
A second answer is from Rashi [Sanhedrin 13b]. He states there, according to one opinion in the Gemara, even if they violate the rule of “lo bd”u Pesach” they can make up for it. Rashi explains that the purpose of this rule of Pesach is to fix up the calendar for the Tishrei holidays so we don’t have two Shabbosos together (meaning Shabbos followed or preceded by Yom Kippur). Therefore, when needed, Beis Din can add to or subtract from the days of the months between Pesach and Tishrei to achieve the desired calendar result.
Perhaps there are additional ways of dealing with this question.