Skip to content

Ramadan 3 stages added in roza and -a mode#28

Open
mehedi37 wants to merge 4 commits intoahmadawais:mainfrom
mehedi37:main
Open

Ramadan 3 stages added in roza and -a mode#28
mehedi37 wants to merge 4 commits intoahmadawais:mainfrom
mehedi37:main

Conversation

@mehedi37
Copy link

@mehedi37 mehedi37 commented Feb 19, 2026

I have added 3 stages of Ramadan Rehmah, Maghfirah, Nijat.
Simple yet meaningful feature.

image image

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getRamadanStage function 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +442 to +468
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;
};
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }>).

Copilot uses AI. Check for mistakes.
mehedi37 and others added 2 commits February 23, 2026 13:31
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>
@mehedi37
Copy link
Author

Thanks for the review! I've applied the suggestion and all the checks are green and ready to go.
@ahmadawais

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants