Skip to content

Optional: advance the daf at nightfall (Hebcal zmanim + location) #3

Description

@Oranburg

Context

Today's daf is currently chosen by the reader's local civil date (getTodaysDaf in src/lib/sefaria.js defaults to the device's local date and asks Sefaria's calendar API). That is correct for most learners. But the Jewish day begins at nightfall, and many learners who study at night consider the next day's daf to begin then. Whether the daf rolls at midnight or at nightfall is a minhag choice, not something the schedule itself encodes.

What we want

An optional setting, "advance to the next daf at nightfall," off by default. When on, after nightfall in the reader's location the app shows the next civil day's daf.

How

  • Location, opt-in: either the browser geolocation API (with permission) or a simple city picker, so we get latitude and longitude. Never track; store only what is needed, on the device.
  • Nightfall time: Hebcal's zmanim API returns nightfall (tzeit) by location and date. Verified working: GET https://www.hebcal.com/zmanim?cfg=json&latitude=..&longitude=..&tzid=..&date=YYYY-MM-DD returns times.tzeit7083deg and similar. Let the reader pick which tzeit (a sensible default).
  • Logic: if the setting is on and the current local time is at or after today's tzeit, call getTodaysDaf(new Date(tomorrow)) instead of today.

Acceptance criteria

  • The civil-date default is unchanged when the setting is off.
  • With the setting on and location granted, in the evening after nightfall the app shows tomorrow's daf, with a small note explaining why.
  • Location is opt-in, and the app works without it (falls back to civil date).
  • The chosen tzeit standard is configurable, with a default.

Pointers

src/lib/sefaria.js (getTodaysDaf already accepts a Date), a new src/lib/zmanim.js for the Hebcal call, and the Settings page. Hebcal zmanim API docs: https://www.hebcal.com/home/1663/zmanim-halachic-times-api

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfuturePlanned, not yet built

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions