2amigos / yii2-editable-widget

X-Editable Widget for Yii2
Other
58 stars 20 forks source link

Datepicker sets wrong date #27

Open uniquexor opened 8 years ago

uniquexor commented 8 years ago

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 commented 8 years ago

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 commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

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 commented 5 years ago

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

tonydspaniard commented 5 years ago

@gb5256 will try to fix it during the week.

gb5256 commented 3 years ago

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: https://github.com/uxsolutions/bootstrap-datepicker/issues/1368 So I guess we should check to replace the source with something different.