Question about Yom Tov
Hi,
I try to get Yom Tov start to end time but i don't how to get it.
For now i 'm able to know if current date is yomTov with
new JewishCalendar(lCalendar).isYomTov();
For example Rosh Hashana 2024 in Paris, i need have start time wednesday 2 october 19h09 and end time friday 4 octobre 20h10
Thanks in advance
@tom42530 , The JewishCalendar has no concept of time. There are a few steps needed for your use case. You are on the correct track though.
- Check to see if today is EREV Yom Tov by calling isErevYomTov().
- Since Erev Yom Tov can sometimes be on a Shabbos, you have to check if today is isAssurBemelacha() before determining what time Yom Tov starts.
- hasCandleLighting() will be helpful.
- To get the TIME of either candle lighting, sunset, tzais etc, you have to use the ZmanimCalendar or ComplexZmanimCalendar to get the times (there are too many opinions for the code to guess what you would like).
Please let me know if there is anything else that I can help clarify.
Ok thanks for the clarification.
here's my working method.
boolean isYomTov() {
Calendar lCalendarTomorrow = Calendar.getInstance();
lCalendarTomorrow.setTimeInMillis(getNow().getTimeInMillis());
lCalendarTomorrow.add(Calendar.DATE, 1);
if (isWorkProhibed(getNow()) && isWorkProhibed(lCalendarTomorrow)) {
return true;
} else if (isWorkProhibed(lCalendarTomorrow)) {
final long lNowMs = getNow().getTimeInMillis();
return lNowMs >= DateUtils.ceiling(buildComplexZmanimCalendar(getNow()).getCandleLighting(), Calendar.MINUTE).getTime();
} else if (isWorkProhibed(getNow())) {
final long lNowMs = getNow().getTimeInMillis();
return lNowMs < DateUtils.ceiling(buildComplexZmanimCalendar(getNow()).getTzaisGeonim8Point5Degrees(), Calendar.MINUTE).getTime();
} else {
return false;
}
}
private boolean isWorkProhibed(Calendar aCalendar) {
JewishCalendar lJewishCalendar = new JewishCalendar(aCalendar);
return lJewishCalendar.isYomTov() && lJewishCalendar.isAssurBemelacha();
}
Feel free to send me remarks if nomething wrong.
Thanks for your work