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

Number of days is not correct #57

Open
medou-boushab opened this issue Nov 29, 2021 · 2 comments
Open

Number of days is not correct #57

medou-boushab opened this issue Nov 29, 2021 · 2 comments

Comments

@medou-boushab
Copy link
Contributor

medou-boushab commented Nov 29, 2021

Hello Vincent,
Thanks for this great library.
We use the library in our project, and we discover that the nb of days in the selected month is not correct for example February is always 31 days.

would you accept a fix for this, I have two solutions for this
1- To change the value of monthDaysWithLasts :
monthDaysWithLasts: {
'1': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'2': ["1W"].concat(r(r(new Array(new Date(new Date().getFullYear(), 2, 0).getDate())).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'3': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'4': ["1W"].concat(r(r(new Array(30)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'5': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'6': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'7': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'8': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'9': ["1W"].concat(r(r(new Array(3)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'10': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'11': ["1W"].concat(r(r(new Array(30)).map(function(e,t){return"".concat(t+1)})),["LW","L"]),
'12': ["1W"].concat(r(r(new Array(31)).map(function(e,t){return"".concat(t+1)})),["LW","L"])
}

2- to calculate monthDaysWithLasts in a separate function

what do you think?

@vincentjames501
Copy link
Owner

@medou-boushab , happy to accept a PR! I'd prefer a function to construct the above objects instead of it being hard coded.

@medou-boushab
Copy link
Contributor Author

Here is my PR #58
I wanted to test my changes locally but I didn't manage to do the build, can you send me the build steps
thanks

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

2 participants