initialMonth: 0, does not work
Closed this issue ยท 7 comments
Hi,
I have encountered an issue which arrises when initialMonth is set to 0 (January). Set from any other month value 1-11 (February-December) the prop provides the expected result, the same goes for initialYear.
When 0 is passed to this prop the inital date for the given calendar is set to the current date instead.
I have done some tracking down of the issue and have found the cause to be this line (DateRangePicker.jsx:127):
127: if (initialYear && initialMonth) {
These props are passed in as number literals, and when set to 0 fail this conditional, which should if passed set up the initialMonth and initialYear to be used in the rendering of the component.
Any suggestions on what this conditional should be instead?
- would initialMonth != null cover enough bases / be appropriate?
- what about initialMonth >= 0?
@AlanFoster Which is the best replacement here? I can make a PR when I know which to go for
@AlanFoster Hi Alan, that PR looks like a good solution, just curious as to what is missing?
@james-ff There's an open question, as well as some missing tests
I'm happy for you to put up a fresh PR that completes the remaining work required though ๐
Released as 2.0.1 - let me know if there's any issues ๐
Issue Solved