Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Datepicker sets wrong date #27

Open
uniquexor opened this issue Dec 7, 2015 · 7 comments
Open

Datepicker sets wrong date #27

uniquexor opened this issue Dec 7, 2015 · 7 comments

Comments

@uniquexor
Copy link

I've noticed that when I use datepicker widget, it set's a wrong date. For example, if I choose 2016-02-04 it would set 2016-02-03 in stead.
After digging around a bit, I found out that the method formatDate in file /assets/datepicker/vendor/js/bootstrap-datepicker.js
is to blame. If I change it to use date.getDay() in stead of date.getUTCDay(), everything works perfectly.
I suppose it has got something to do with the fact that I live in UTC +2h timezone.

@evgenyvas
Copy link

I changed datepicker widget on other working one.
https://github.com/comdvas/bootstrap-editable-datetimepicker/blob/master/bootstrap-editable-datetimepicker.js
Just set 'datetime2' as type parameter.

@tonydspaniard
Copy link
Member

@comdvas @uniquexor very sorry for being unresponsive. I believe we simply need to update the vendor files. I am looking towards fixing the issue, maybe you guys can help.

@evgenyvas
Copy link

@tonydspaniard
You can replace datetimepicker widget by this one, that gives me more confidence:
https://github.com/Eonasdan/bootstrap-datetimepicker
And use my wrapper from above message.
I did not try to update current widget vendor files, maybe this bug was fixed already.

@tonydspaniard
Copy link
Member

I did not try to update current widget vendor files, maybe this bug was fixed already.

@comdvas Thank you very much for your suggestion, will try to test it as soon as possible. This library needs anyway an update. If you have time for a PR or tried the new update and is working let us know. Thanks!

@gb5256
Copy link

gb5256 commented Mar 21, 2019

Any news on this one? It looks like this error is still happening and makes the datepicker pretty useless...

@tonydspaniard
Copy link
Member

@gb5256 will try to fix it during the week.

@gb5256
Copy link

gb5256 commented Dec 23, 2020

Hello,
I have just created a fork of this one and added one new branch:
https://github.com/gb5256/yii2-editable-widget/tree/bugfix-vendor-files
There I have updated the vendor files for timepicker to the latest version over at
https://github.com/uxsolutions/bootstrap-datepicker

But the bad news is that it makes no difference for this problem. UTC dates are still used and therefore creating an offset with the local date picked.

I then googled a bit around, and it seems to be a common problem with this library. Like discussed here:
uxsolutions/bootstrap-datepicker#1368
So I guess we should check to replace the source with something different.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants