-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Datepicker popup UTC Timezone issue #6235
Comments
Another thing I just noticed is if you select a date from the popup X amount of times where The offset seems to be constantly getting added and never zeroed out |
+1 |
Unfortunately there seems to be some issues with the timezone handling since 2.0.0 but your first post sounds like the same root cause as this issue that I just filed: #6252 Try setting your |
Hi, I tried to track down the origin of this issue. It seems to come from bootstrap/src/datepickerPopup/popup.js Line 336 in 997813f
In UIBS 1.3.x the conversion was The date converted here was created by Changing the line back to It would be nice if someone from the UIBS team can look into this issue and review the workaround I suggest. |
@noullet this sounds correct - pushing change shortly. |
This did not seem to fix any of the two issues, am I doing something wrong? Here is new plunk with updated UIB code. http://plnkr.co/edit/i2yg2cwHg7GC28Z7FhcC?p=preview The date on the popup is still incorrect and clicking the date multiple times will still change the date. |
Reopening to investigate. |
I mistakenly believed that my issue had the same root as you @msosa, but it seems to be a third Timezone issue, independent from yours, sorry for the confusion... |
Seems that using ng-model-options="{timezone: 'utc'}" is not working with angular 1.6.x. ngModelOptions: This does not affect the usage in templates and only affects custom directives that might have been reading options for their own purposes. If you were programmatically accessing the options, you need to change your code as follows: Before: |
Yes this is problem after this change. I debug the problem on example of Bootstrap Datepicker version 2.3.1. In file ui-bootstrap-tpls in line 3044 they use But it can be also a problem for other libraries that use access to model options directly by object not by getter. |
I'm not sure if it's related to any or all of the issues presented here but there's still definitely an issue with the latest version (v2.5) and |
We also see problems with the datepicker popup in 2.5.0 (2.4.0 is fine, we're thinking that 0d79005 is the cause): We have |
We also have a similar problem with datepicker and UTC settings. When we're in GMT -X, then the value set for ng-model is correct, but value displayed in text box is incorrect, is shifted by X (e.g. if we select 10-10-2000 and we're in GMT-5 timezone, then in text box we received 09-10-2000, because the date is shifted by -5 hours, ng-model contains correct value) |
I'm also having a similar problem. on Angular 1.6.1 UIBS 2.5.0 I have defined ng-model-options in various places trying to get this to work. The issue is if I set a time and move to another timezone then I have issues. |
I'm also having same @DakJack's problem, Angular 1.6.1 UIBS 2.5.0 and UIBS 2.4.0 My model come from Mysql, for example: 2017-06-23, but I resolved parsing with uibDateParser. $scope.dateTest = uibDateParser.parse($scope.dateTest , 'yyyy-MM-dd', new Date()); |
Any news here? |
I am using global datefilter decorator for setting timezone. If current local timezone differs from those above, datepicker active date doesnt work correct, cause it uses start and end of te day in local timezone $provide.decorator('dateFilter', ['$delegate', '$injector', ($delegate, $injector) => {
const delegate = $delegate;
return function (date, format, timezone) {
if (angular.isUndefined(timezone)) {
timezone = '+0300';
}
return delegate.apply(this, [date, format, timezone]);
};
}]); |
You'll find below how I found and solved my issues, hope this will help! Problem My context
Investigation The first step consisted in understand how the popover worked. For the inline version, the The first issue I found is that the ng-model-options are not passed in this process, so when using the inline version, Fixing this is easy, great I'm done! Actually, not so much... Indeed, I think the developers never got this "working" version, so they based their testing on erroneous premises. Thus, fixing the issue revealed all the code that did not take into account properly the conversion from and to the Solution Disclaimer
Let me know if it works for you! |
Bug description:
I've noticed a weird issue when using the UTC timezone. For users west of UTC, like NY, adding the ng-model-options to UTC things work as they should.
However when you set your local timezone to something like UTC+2 and you open the popup that contains the ng-model-options, the date is highlighted incorrectly to the day before. The popup without the ng-model-options highlights the day correctly
Link to minimally-working plunker that reproduces the issue:
http://plnkr.co/edit/Y28iutmgkWkCINTUvRoq?p=preview
The first popup is the one without the ng model options, the second one contains it.
Version of Angular, UIBS, and Bootstrap
Angular:
1.5.8
UIBS:
2.1.3
Bootstrap:
3.3.6
The text was updated successfully, but these errors were encountered: