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

Month selector always wrong on 30 or 31 of the month if you select months that has lesser days #297

Open
dickverweij opened this issue Jan 31, 2017 · 11 comments

Comments

@dickverweij
Copy link

This is caused by the following code that appears everywhere in the code.

$scope.currentDate.setMonth(XXX)

For example:
if the currentDate = 31-Jan-2017 setting the month on februari
will result in 31-Feb-2017. That date does not exist and will result in 03-Mar-2017

@postb99
Copy link

postb99 commented Mar 24, 2017

Hi @dickverweij, please can you describe more precisely how you use the date picker. Your bug report is totally correct, but as far as I can play with the date picker, I have to click onto a date to set the new date. Changing month has no effect on selected date. I don't find how to reproduce the bug!

I wish to correct it. Thank you.

@dickverweij
Copy link
Author

Note you can ONLY reproduce the bug if the CURRENT DATE is > 29 of the month.. and the month you want to set hasn’t that many days..

$scope.currentDate is the current date.
for example 31-3-2017
now you call SET MONTH (4)

$scope.currentDate.setMonth(4) .. what is currentDate now?
$scope.currentDate = 31-4-2017 .. that date dos not exist and javascripts makes it 1-5-2017

So IF you use the date picker ON the date 31-3-2017, when you press on April,.. you think you GOTO april, but you will go to may..

@postb99
Copy link

postb99 commented Mar 28, 2017

Thanks for the feedback. I fixed it on my fork but haven't released the new version for now, I'm looking for some other things to fix these days. I found that the next month selector was bug free since it first sets the day to 1, but the previous month selector indeed had the bug. From March 28 you were jumping to January.

My fix was simply also setting to day to 1 when going back to previous month.

Oops, I misunderstood, not only next/previous month but also any month. I'll fix it.

https://github.com/OSAMES/ionic-datepicker/commits/v1.4.0
OSAMES@f572d29

@postb99
Copy link

postb99 commented Mar 29, 2017

Hi @dickverweij I fixed it the same way, setting day to 1 before setting current month.
So, going to February from today (March 29!) works now.

Fixed on my fork, version 1.4.0. bower package name is ionic-datepicker-fork-ionic1

My fork : https://github.com/OSAMES/ionic-datepicker

I wish I could do a pull request but since I changed package name etc I don't know how to handle this.

@postb99
Copy link

postb99 commented May 2, 2017

Fixed for original project : #315

@postb99
Copy link

postb99 commented May 8, 2017

Hi @dickverweij in case you're still interested, my stable fork is ready (version 1.5.0): https://github.com/OSAMES/ionic-datepicker

@fgagneten
Copy link

@postb99 Can you change the positions of the close and set button please in your fork? Thanks!

@postb99
Copy link

postb99 commented May 19, 2017

Hi @fgagneten, you're right, it's a better idea to swap them. I do this now, this will be version 1.5.1.

@postb99
Copy link

postb99 commented May 19, 2017

OK @fgagneten, it's ready, you can install it using bower. https://github.com/OSAMES/ionic-datepicker/releases/tag/v1.5.1

@fgagneten
Copy link

Thanks @postb99 , how can I using with bower? Please, give me the line code to run. Thanks

@fgagneten
Copy link

@postb99 There is such a big error. Please, see this video to know what's going on with this fork:
https://streamable.com/0xic0

Using the original library this error not happening. Please, is too important to solve the problem when you limit the first and the last day in the calendar

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

3 participants