bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Timezone issue with Datepicker and inconsistency

Open ghost opened this issue 11 years ago • 9 comments

UI Bootstrap: 0.13.3 AngularJS: 1.4.4

Starting out

  1. Open this Plunker http://plnkr.co/edit/vcOgtMr0XSS3Mewj0KTK?p=preview
  2. Observe that the input matches the model.

start

Problem 1

  1. Pick 30-01-2015 (dd-mm-yyyy) in the popup in both of the inputs.
  2. Observe that the input without a starting value (top field ) has an incorrect date in the model. While this might be caused by a timezone issue, then why doesn't the input with a starting value also do this?

image

Problem 2

  1. Reload the page, so we start from fresh.
  2. Pick 20-05-2015 (dd-mm-yyyy) in the popup in both of the inputs.
  3. Observe that now both fields have the wrong date in the model. It's not even the same incorrect value. This extra offset might be due by summer time.

image

Problem 3

  1. Reload the page, so we start from fresh.
  2. Click the Today button (for me that's 27-08-2015 (dd-mm-yyyy)) in the popup in both of the inputs.
  3. Observe that the value in the model is now the same incorrect value, unlike previous.

image

Problem 4

  1. Reload the page, so we start from fresh.
  2. Pick any date in the popup in both of the inputs.
  3. Click the Today button (for me that's 27-08-2015 (dd-mm-yyyy)) in the popup in both of the inputs.
  4. Observe that problem 3 isn't consistent as it now appears to behave like problem 2.

image


While I understand where the problem is coming from. Some sort of configuration for handling timezone/summer time is needed so the correct value can be set in the model.

Happy to hear about workarounds :)

ghost avatar Aug 27 '15 12:08 ghost

Thanks for the details - this is indeed a bug that has been reported multiple times (there are other open issues on this).

wesleycho avatar Aug 27 '15 15:08 wesleycho

Waiting for this fix like crazy! Thanks :+1:

juanpujol avatar Sep 09 '15 19:09 juanpujol

+1

nipec avatar Sep 10 '15 08:09 nipec

This is a bigger issue than I thought. Without the ability to use dates as strings since 13.2 I cannot find a way at all to keep the dates consistent between the model and the calendar.

Did anybody found a hack or something for that while we wait for an update? Thanks.

juanpujol avatar Sep 10 '15 11:09 juanpujol

+1

yaronmiz avatar Sep 11 '15 05:09 yaronmiz

Please do not +1 issues. It doesn't add anything to the discussion and clutters the thread. Thank you.

icfantv avatar Sep 11 '15 05:09 icfantv

any idea on when this bug will get fixed?

raftalks avatar Oct 15 '15 23:10 raftalks

Just noting:

1 & 3) This turns out to not be a bug - one must be careful when parsing dates since date.toJSON() will munge the timezone information into the date string itself, which can cause the date representation to shift by a day. There is nothing we can do here, and this is a usage issue - this Plunker should help in exposing this.

2 looks like it might be a legitimate issue though, and should be investigated.

wesleycho avatar Oct 21 '15 06:10 wesleycho

It should be noted that we no longer support date strings in the model.

2 & 4 no longer appear to be issues anymore, as can be seen in this Plunker

wesleycho avatar Nov 02 '15 00:11 wesleycho