yii2-editable-widget icon indicating copy to clipboard operation
yii2-editable-widget copied to clipboard

Datepicker sets wrong date

Open uniquexor opened this issue 9 years ago • 7 comments

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.

uniquexor avatar Dec 07 '15 16:12 uniquexor

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.

evgenyvas avatar Jun 09 '16 11:06 evgenyvas

@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.

tonydspaniard avatar Jul 05 '17 08:07 tonydspaniard

@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.

evgenyvas avatar Jul 12 '17 13:07 evgenyvas

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!

tonydspaniard avatar Jul 12 '17 14:07 tonydspaniard

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

gb5256 avatar Mar 21 '19 11:03 gb5256

@gb5256 will try to fix it during the week.

tonydspaniard avatar Apr 08 '19 15:04 tonydspaniard

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.

gb5256 avatar Dec 23 '20 13:12 gb5256