Fix: roza -a fails after setting --first-roza-date#30
Draft
Conversation
Co-authored-by: ahmadawais <960133+ahmadawais@users.noreply.github.com>
Co-authored-by: ahmadawais <960133+ahmadawais@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug with fetching prayer times after date change
Fix: Feb 19, 2026
roza -a fails after setting --first-roza-date
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.
When
--first-roza-dateis set,roza -aandroza --number NusefetchCustomRamadanDayswhich fired 30 parallel requests to the AlAdhan API — one per Ramadan day. This saturates the API's rate limit, returning non-standard error responses that fail Zod'sApiEnvelopeSchemavalidation (codefield missing → "Required"), causing all three fallback methods to fail simultaneously. Without--first-roza-date,roza -auses a single bulk Hijri calendar call and never hits this limit.Changes
fetchCustomRamadanDaysrewritten to use the Gregorian monthly calendar API (calendarByAddress/calendarByCity) instead of 30 individual timing calls. A 30-day Ramadan period spans at most 2 calendar months, so this reduces the call count from 30 → 1–2.fetchGregorianMonthCalendaradded — mirrors the fallback chain pattern offetchRamadanCalendar(address → city).toApiDateStringadded — formats aDatetoDD-MM-YYYYto match AlAdhan API date keys used for day lookup after fetching the monthly calendar.api.test.ts: added test forfetchCalendarByAddress.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.