Skip to content

refactor: rename month0 to month for consistent 0-indexed convention#120

Open
abhiyankhanal wants to merge 1 commit intoopensource-nepal:mainfrom
abhiyankhanal:refactor/update-month0-to-month
Open

refactor: rename month0 to month for consistent 0-indexed convention#120
abhiyankhanal wants to merge 1 commit intoopensource-nepal:mainfrom
abhiyankhanal:refactor/update-month0-to-month

Conversation

@abhiyankhanal
Copy link

Summary

  • Standardize month variable naming so month always means 0-indexed (0-11), matching JavaScript's Date.getMonth() convention
  • Rename internal 1-indexed month variables to month1Indexed in dateConverter.ts
  • Update interface properties, local variables, return objects, destructuring, and JSDoc across 5 files

Closes #97

Changes

  • src/dateConverter/dateConverter.ts: Rename parameter month0month in englishToNepali() and nepaliToEnglish(), rename internal const monthconst month1Indexed
  • src/NepalTimezoneDate.ts: Rename interface property month0month, local variable npMonth0npMonth, fix JSDoc on getDate()
  • src/parse/parse.ts: Rename local variable and return property month0month
  • src/parse/parseEnglishDate.ts: Rename return property month0month
  • src/NepaliDate.ts: Rename month0NpmonthNp, month0ENmonthEn, month0month in fromEnglishDate() and static parse methods

Test plan

  • All 339 existing tests pass without modification
  • No remaining month0 references in src/
  • Pre-commit hooks (prettier, lint-staged, jest) pass

🤖 Generated with Claude Code

…ion (opensource-nepal#97)

Standardize month variable naming across the codebase so that `month`
always means 0-indexed (0-11), matching JavaScript's Date.getMonth().
Internal 1-indexed variables are renamed to `month1Indexed`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@aj3sh aj3sh left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. I am added one minor suggestion. Please have a look.

return {
year,
month0: month - 1,
month: month - 1,
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: month: month - 1; the previously parsed month variable is month1Indexed. Let's rename this variable to resolve confusion.

@aj3sh aj3sh requested a review from sugat009 March 9, 2026 04:46
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.

refactor: update month0 variable name to month

2 participants