valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

(Bug) - While modifying existing date with keyboard showing previous day #5184

Open dsudheer opened 5 years ago

dsudheer commented 5 years ago

Bug description or feature request:

While modifying existing date with keyboard showing previous day

To replicate bug follow below steps Step-1 Please select date with datepicker in MM/DD/YYY format i.e 05/10/2019 and the output will be "date": "2019-05-10T12:06:31.000Z" as UTC

Step-2

Now using keyboard edit the date to 05/09/2019 and press tab you will get oneday before date this is current locale time with previous day "date": "2019-05-08T18:30:00.000Z"

Plunker/StackBlitz that reproduces the issue:

StackBlitz: https://stackblitz.com/edit/angular-rseren

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 4.1.1

Angular: 7.2.5

Bootstrap: 4.1.1

Current Locale: Console: var date = new Date().getTimezoneOffset() undefined date -330 const tz = Intl.DateTimeFormat().resolvedOptions().timeZone; undefined tz "Asia/Calcutta"

Build system: Angular CLI, System.js, webpack, starter seed:

Angular CLI

ludmilanesvitiy commented 5 years ago

@dsudheer Hi! Your stackblitz example is broken. Please, fix it for reproducing. Also take a look at these related issues: https://github.com/valor-software/ngx-bootstrap/issues/4464 https://github.com/valor-software/ngx-bootstrap/pull/4771

dsudheer commented 5 years ago

Now stackblitz example fixed and working fine. Please have look into this

pzontrop commented 5 years ago

@dsudheer @ludmilanesvitiy I can confirm what you are seeing and I can also add that this also happens when changing the month. So picking a date from the initial month is fine, but clicking the arrows to change a month and then picking a date also makes the picker go back one day.

Screenshot 2019-06-04 at 10 37 18

It is probably related to the timezone but the fact that it only happens if the month has been changed (by clicking the arrows) makes it impossible to patch. That is why the related issues are not delivering a valid solution.

tomascubeek commented 4 years ago

Hello, are there any plans (progress) for this? We have this "inconsistency" bug in our products as well. It's enough to modify date by keyboard instead of selecting by mouse and it returns different value. Since it's inconsistent I can't easily play around with UTC / timezones.

Emprint commented 4 years ago

I confirm this bug is still present with the current release (5.6.2). Please see below stackblitz: https://stackblitz.com/edit/angular-lbv6tb?file=app/basic.html

babbubba commented 3 years ago

This bug is still present in 6.2.0 and I can't find any workaround... Any suggested workaround is appreciated.