Ngx-bootstrap: Datepicker incorrect date if UTC time results in local offset midnight

Created on 14 Oct 2019  路  15Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

If a date is fed into the datepicker that results in a local time of exactly midnight, the datepicker shows the incorrect date. For example, incoming time is 2019-08-26T22:00:00.000Z and the local time zone is GMT+2, the date SHOULD show as 2019-08-27. This is not the case however and it seems to be a regression from all version higher than 5.1.2 (last correctly functioning version). 5.20 and 5.3.0 at least are broken.

Plunker/StackBlitz that reproduces the issue:

I made 2 repo's that show this. These are identical and very minimal, except for the ngx-bootstrap versions:

WORKING (5.1.2 - shows 27-08-2019) -> https://github.com/MikeOne/ngx-bootstrap-datepicker-512
StackBlitz: https://stackblitz.com/github/MikeOne/ngx-bootstrap-datepicker-512

BROKEN (5.2.0 - however, 5.3.0 is also broken - shows 26-08-2019) -> https://github.com/MikeOne/ngx-bootstrap-datepicker-520-bug
StackBlitz: https://stackblitz.com/github/MikeOne/ngx-bootstrap-datepicker-520-bug

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 5.2.0 or higher

Angular: 8.2.x

Bootstrap: Not relevant.

Build system: Angular CLI

Most helpful comment

@MikeOne Needs some investigation, I'll check and I'll cancel the commit if needed.

All 15 comments

Can someone please confirm this issue? I鈥檓 willing to have a stab at fixing this if someone can point me in the right direction (although I think I identified the commit that broke this..)

Hi @MikeOne

I'm having the same issue.

5.1.0:
image

5.3.0:
image

Thanks for confirming. Hopefully this will be picked up soon.

Yes that would be nice. I'm implementing the DateRangePicker in our application and I can't finish the feature while this bug persists, because ngx-bootstrap is used in other parts of the application.

Thx for posting the issue!

Which commit do you think introduced the bug?

@MikeOne Needs some investigation, I'll check and I'll cancel the commit if needed.

I have the same issue. V5.1.2 works. After that all versions are broken.

Was this issue fixed in 5.3.1? @Domainv?

@MikeOne Yes

Hi @Domainv
The bug seems to persist even after I updated to 5.3.1.
Somebody else experiencing this?

@An-MS In 5.1.2 works?

@An-MS In 5.1.2 works?

@Domainv Yes, it works with 5.1.2

@An-MS Oh, you are right. I'll make quick fix and patch release

@An-MS @MikeOne
use 5.3.2 version please

@Domainv
Thank you, it works now!

The problem still seem to exist in 5.3.2 for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tpiros picture tpiros  路  3Comments

pgeyman picture pgeyman  路  3Comments

KimBum picture KimBum  路  3Comments

MihaiHoriaPopescu picture MihaiHoriaPopescu  路  3Comments

ghiscoding picture ghiscoding  路  3Comments