Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Month Normalization in normalizeRange Function #5

Open
wassim-ben-amor opened this issue May 31, 2024 · 0 comments
Open

Incorrect Month Normalization in normalizeRange Function #5

wassim-ben-amor opened this issue May 31, 2024 · 0 comments

Comments

@wassim-ben-amor
Copy link

wassim-ben-amor commented May 31, 2024

Hi,

I encountered an issue with the normalizeRange function in the inquirer-datepicker codebase. The function subtracts 1 from the month value, which leads to unexpected behavior and "Invalid Date" errors when creating moment objects. This substraction seems unnecessary and incorrect because it converts a correctly indexed month into an incorrect one.

Steps to Reproduce
1- Define a date object with the current month using new Date().getMonth(), which returns a 0-based index for the month.
2- Pass this object to the normalizeRange function.
3- The normalizeRange function subtracts 1 from the month value, resulting in an incorrect month value.
4- Create a moment object with the normalized date object.
The moment object returns "Invalid Date" due to the incorrect month value.

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

No branches or pull requests

1 participant