Skip to content

fix: validate length parameter value and use avg month calculation#10

Open
Hitchhiker007 wants to merge 1 commit into
artisticLogicMK:masterfrom
Hitchhiker007:fix/month-calculation-and-length-validation
Open

fix: validate length parameter value and use avg month calculation#10
Hitchhiker007 wants to merge 1 commit into
artisticLogicMK:masterfrom
Hitchhiker007:fix/month-calculation-and-length-validation

Conversation

@Hitchhiker007
Copy link
Copy Markdown

Hi! These are the changes I made.

Invalid length parameter returns undefined
Passing an invalid length value like "long" would silently return undefined instead of throwing an error. So I added a value check after the existing type check to throw a descriptive error for any value other than "null", "short", or "shorter".

Changed month calculation
The month unit was using 2,419,200 seconds (28 days) as its base. I updated it to 2,629,800 seconds, which reflects the average month length of 30.44 days (365.25 days ÷ 12), which accounts for leap years.

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.

1 participant