Git Product home page Git Product logo

Comments (6)

KosherJava avatar KosherJava commented on August 22, 2024

@chacham2 , See JewishDate.forward(int field, int amount). For the zmanim that are directly tied to the GregorianCalendar just maintain a calendar and roll it, and set the GregorianCalendar AstronomicalCalendar.setCalendar(Calendar calendar). Please let me know if this addresses your question.

from zmanim.

chacham2 avatar chacham2 commented on August 22, 2024

I'm trying to understand how to use that. Maybe i can form simpler questions to get it straight in my own head:

  1. If i instantiate ZmanimCalendar, it gives me zmanim for today. When it runs overnight and the computer clock changes, will the zmanim now be the next day, or do i need to reset it?

  2. I want to find the parasha of the week for use with formatParsha(). However, that requires an instantiation of JewishCalendar set to this week's Shabbos. Starting with ZmanimCalendar, how do i get a JewishCalendar for the coming Shabbos. (The Shabbos may be in the following month, so i assume adding days is required.) Do i need to maintain the date separately and keep it in sync?

  3. I want to display the day's daf. That requires formatDafYomiBavli() which requires JewishCalendar.getDafYomiBavli() which requires an instantiation of JewishCalendar. Similar to #2, starting with ZmanimCalendar, how do i get a JewishCalendar?

Or, am i approaching this entirely wrong?

from zmanim.

KosherJava avatar KosherJava commented on August 22, 2024

If i instantiate ZmanimCalendar, it gives me zmanim for today. When it runs overnight and the computer clock changes, will the zmanim now be the next day, or do i need to reset it?

No. The class is not time aware and nothing will change.

I want to find the parasha of the week for use with formatParsha(). However, that requires an instantiation of JewishCalendar set to this week's Shabbos. Starting with ZmanimCalendar, how do i get a JewishCalendar for the coming Shabbos. (The Shabbos may be in the following month, so i assume adding days is required.) Do i need to maintain the date separately and keep it in sync?

Jump to the next Shabbos. If getParsha() returns a real parsha, good, if not, move forward 7 days and try again.

I want to display the day's daf. That requires formatDafYomiBavli() which requires JewishCalendar.getDafYomiBavli() which requires an instantiation of JewishCalendar. Similar to #2, starting with ZmanimCalendar, how do i get a JewishCalendar?

Use ZmanimCalendar.getCalendar().getCalendar() for a reference to the GregorianCalendar used by the ZmanimCalendar. Pass this to JewishCalendar.setDate​(Calendar calendar) to set it there. At that point you can just get the daf. Ultimately you want to manage the calendar in one place, and you may as well do it in the ZmanimCalendar by setting the GregorianCalendar there.

Please let me know if this addressed your questions.

from zmanim.

chacham2 avatar chacham2 commented on August 22, 2024

Sorry, for the basic questions. I'm trying to have it all click so i get what the best approach is.

No. The class is not time aware and nothing will change.

Thank you. That answers that question.

Jump to the next Shabbos. If getParsha() returns a real parsha, good, if not, move forward 7 days and try again.

Wouldn't that always return nothing? I think i'd need to add one day at a time and check. Though, 6- JewishCalendar.getDayOfWeek() ought to give me the right amount of days to add. My question is how to add them. One way would be to use JewishDate.forward(), and then JewishCalendar.setDate(JewishDate.getLocalDate()) or something. I'm not quite sure. Though, at that point it seems easier to just use the system date directly via JewishCalendar.setGregorianDate.

Ultimately you want to manage the calendar in one place, and you may as well do it in the ZmanimCalendar by setting the GregorianCalendar there.

This is so confusing. I just need four objects: ZmanimCalendar, JewishCalendar set to today and another set to the coming Shabbos, and JewishDate set to today. Maybe i can just reset when the day changes. That is, JewishDate.resetDate(), JewishCalendar.resetDate(), and Zemanim.setCalendar(JewishCalendar.getGregorianCalendar). For Shabbos, just maintain a local date in vb, and use JewishCalendar.setGregorianDate(year, month, date) as shown above. I feel like i'm reinventing the wheel though.


Do you want typos reported? While looking at the documentation i found:

https://github.com/KosherJava/zmanim/blob/master/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishDate.java#L1331
one day t a time -> one day at a time

https://github.com/KosherJava/zmanim/blob/master/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java#L66
second edition published -> second edition, published

https://github.com/KosherJava/zmanim/blob/master/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java#L78
a degree based offset -> a degree-based offset (not sure about this one)

from zmanim.

KosherJava avatar KosherJava commented on August 22, 2024

@chacham2, there is now a getUpcomingParsha(). See 52e49 . Does this address your issue?

from zmanim.

chacham2 avatar chacham2 commented on August 22, 2024

Very likely does, thank you.

Fwiw, i am no longer working on the project though. After this, that, and the other, someone else took over the project and took another route. Regardless, this is a nice addition!

from zmanim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.