Skip to content

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

Open
abhiyankhanal wants to merge 2 commits 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 2 commits 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.

@aj3sh aj3sh requested a review from sugat009 March 9, 2026 04:46
Rename the local 1-indexed month variable to month1Indexed in
getDateParams() to clarify that it holds a 1-indexed value before
being converted to 0-indexed in the return object.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@abhiyankhanal abhiyankhanal requested a review from aj3sh March 11, 2026 13:19
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.

Looks good. @abhiyankhanal Could you please squash the commit and set the commit length to 72. The checks are failing.

https://dev.to/noelworden/improving-your-commit-message-with-the-50-72-rule-3g79

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