refactor: rename month0 to month for consistent 0-indexed convention#120
Open
abhiyankhanal wants to merge 1 commit intoopensource-nepal:mainfrom
Open
refactor: rename month0 to month for consistent 0-indexed convention#120abhiyankhanal wants to merge 1 commit intoopensource-nepal:mainfrom
month0 to month for consistent 0-indexed convention#120abhiyankhanal wants to merge 1 commit intoopensource-nepal:mainfrom
Conversation
…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>
aj3sh
reviewed
Mar 9, 2026
Member
aj3sh
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I am added one minor suggestion. Please have a look.
| return { | ||
| year, | ||
| month0: month - 1, | ||
| month: month - 1, |
Member
There was a problem hiding this comment.
suggestion: month: month - 1; the previously parsed month variable is month1Indexed. Let's rename this variable to resolve confusion.
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.
Summary
monthalways means 0-indexed (0-11), matching JavaScript'sDate.getMonth()conventionmonthvariables tomonth1IndexedindateConverter.tsCloses #97
Changes
src/dateConverter/dateConverter.ts: Rename parametermonth0→monthinenglishToNepali()andnepaliToEnglish(), rename internalconst month→const month1Indexedsrc/NepalTimezoneDate.ts: Rename interface propertymonth0→month, local variablenpMonth0→npMonth, fix JSDoc ongetDate()src/parse/parse.ts: Rename local variable and return propertymonth0→monthsrc/parse/parseEnglishDate.ts: Rename return propertymonth0→monthsrc/NepaliDate.ts: Renamemonth0Np→monthNp,month0EN→monthEn,month0→monthinfromEnglishDate()and static parse methodsTest plan
month0references insrc/🤖 Generated with Claude Code