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
field with Pikaday is automatically going backwards by one day everytime record is edited. #39
Comments
Adding moment.js makes this problem disappear, but still would be curious as to what I may have done wrong or whether or not this is a bug. |
Difficult to say what's going on here, doesn't look like you're doing anything wrong. Can you upload an example? |
Hello again David. |
Could you indeed please host it, I would like to have a look myself. |
I updated the app and pushed it to Heroku. I loaded a single post. It is a simple app, but hope it is useful for you. I'll keep it up for a week so you have enough time to check it out. The app is at http://backaday.herokuapp.com Rikkert, I added you as a collaborator on the Github repo in case you are interested in the underlying code. Again, this is a Rails site. |
Great thanks. I edited the post a couple times: All of these actions had the expected result: either date was 1 jan or 2 jan. |
To quote a recent movie. "You had my curiosity. Now you have my attention." I have uploaded a short movie in which I went through various browsers on Mac OS Mountain Lion, Windows XP, Windows 7 and Windows 8. Long story short, I did notice that the problem did not occur in Safari on Windows 7 or 8, but did occur in all other browsers on all platforms.
Thanks for taking a look. BTW, I did want to mention that I really like Pikaday. Stopped using JQuery-UI datepicker when I found this little gem. :0) So keep up the great work! |
Yep, I was on Linux with chrome 26. |
I loaded up Ubuntu and it seems to do this is Firefox. |
It is caused by your local (browser) time zone settings. Otherwise I can`t really debug your app because it is minimized. |
Unfortunately it still goes back. In my Rails app I declare a time zone which I thought helped keep things happy with time based fields since I offset from GMT. I appreciate your effort. My fix was just to load moment.js which is a recommended option anyway so harmless and easy. If you need me to try anything else let me know.. I will go ahead and close this ticket with this comment. Again, thanks for developing Pikaday, I like that it is lighter and cleaner to use than JQuery datepicker. LLAP. |
You gave enough info to reproduce the problem. It was only a bit tricky because I had to change my local time-zone. |
Hi guys, We has the same problem and I fixed creating the new Date splitting the date and not using the Date.parse method. In the setDate method, replace the entire if with: if (typeof date === 'string') {
var p = date.split('-'); // We use the format YYYY-MM-DD in our dates.
date = new Date(p[0], p[1] - 1, p[2]);
} And that's it, it works perfect without adding Momentjs to your project. Hope this help, |
Still having this issue with latest version.. seems to have to do with timezone setting, not sure how to fix any help appreciated |
I'm also experiencing a similar issue.. |
Note that when you have a date (like that returned from
This took me a few minutes to realise so I thought I'd put this here in case other are getting confused. |
For anyone using Ruby/Rails, I found that adding |
This worked for me. In the setDate function of Pikaday.js add:
I am adding 500 milliseconds because sometimes the calculation is a little off and since my app is saving dates and midnight it would occasionally show the wrong day if the calculation came back slightly short. |
I have a field called last_issue on a rails model. If a date exists in the the last_issue field, every time you edit the record, the date appears to be dropping back by one day. Edit a record seven times and your date will be off by a week from where it started.
I am using the following setting for this field:
picker = new Pikaday(field: $("#issue_date")[0])
Any suggestions as to why this is happening?
The text was updated successfully, but these errors were encountered: