Ramadan 3 stages added in roza and -a mode#28
Ramadan 3 stages added in roza and -a mode#28mehedi37 wants to merge 4 commits intoahmadawais:mainfrom
roza and -a mode#28Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for displaying the three stages (Ashra) of Ramadan in the CLI application. Each Ashra represents a 10-day period with specific spiritual significance: Rehmah (Mercy, days 1-10), Maghfirah (Forgiveness, days 11-20), and Nijat (Salvation, days 21-30).
Changes:
- Added
getRamadanStagefunction to determine which Ashra a given roza (fast day) belongs to - Modified the table display to show stage headers when using the
-a(all) mode - Added stage information display in single-day/today mode
- Included comprehensive test coverage for the new function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/commands/ramadan.ts | Implements the Ramadan stage logic with new interface, constants, helper functions, and integration into the display output |
| src/tests/ramadan.test.ts | Adds comprehensive test coverage for the getRamadanStage function covering all three stages and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| interface RamadanStage { | ||
| readonly ashra: number; | ||
| readonly name: string; | ||
| readonly meaning: string; | ||
| readonly startRoza: number; | ||
| } | ||
|
|
||
| const RAMADAN_STAGES: ReadonlyArray<RamadanStage> = [ | ||
| { ashra: 1, name: 'Rehmah', meaning: 'Mercy', startRoza: 1 }, | ||
| { ashra: 2, name: 'Maghfirah', meaning: 'Forgiveness', startRoza: 11 }, | ||
| { ashra: 3, name: 'Nijat', meaning: 'Salvation', startRoza: 21 }, | ||
| ]; | ||
|
|
||
| const ASHRA_LABELS: ReadonlyArray<string> = ['1st', '2nd', '3rd']; | ||
|
|
||
| export const getRamadanStage = (rozaNumber: number): RamadanStage | null => { | ||
| if (rozaNumber < 1 || rozaNumber > 30) { | ||
| return null; | ||
| } | ||
| if (rozaNumber <= 10) { | ||
| return RAMADAN_STAGES[0] ?? null; | ||
| } | ||
| if (rozaNumber <= 20) { | ||
| return RAMADAN_STAGES[1] ?? null; | ||
| } | ||
| return RAMADAN_STAGES[2] ?? null; | ||
| }; |
There was a problem hiding this comment.
getRamadanStage is exported but its return type references RamadanStage, which is currently a non-exported interface. With declaration: true in tsconfig, this will cause a TS error during declaration emit (exported API using a private type). Export the RamadanStage type/interface, or change getRamadanStage to return an exported/public type (e.g., Readonly<{ ashra: 1|2|3; name: string; meaning: string }>).
RAMADAN_STAGES defines startRoza, but getRamadanStage uses hard-coded cutoffs (10/20). This creates a maintainability hazard where editing RAMADAN_STAGES can silently desync the stage-selection logic. Consider deriving the stage from startRoza (e.g., pick the last stage with startRoza <= rozaNumber) so there’s a single source of truth. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks for the review! I've applied the suggestion and all the checks are green and ready to go. |
I have added 3 stages of Ramadan
Rehmah,Maghfirah,Nijat.Simple yet meaningful feature.