Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker - date selected is previous day if changing month #3104

Closed
marcotoldo opened this issue Nov 23, 2017 · 5 comments
Closed

DatePicker - date selected is previous day if changing month #3104

marcotoldo opened this issue Nov 23, 2017 · 5 comments

Comments

@marcotoldo
Copy link

marcotoldo commented Nov 23, 2017

Version: 1.9.3

Step to reproduce:

  • open a datepicker (opens up in november)
  • move to next or previous month (ex. move to december)
  • select a date (ex. december, 12)

Result:
Selected date (binded to a Date variable via ngModel) is "2017-12-11T23:00:00.000Z" rather than ""2017-12-12T[current time]Z"
Same occurs when moving back to a previous month. In that case the only difference is that it always selects the previous day at 22:00:00.

@IlyaSurmay
Copy link
Contributor

Could you provide a plunkr/stackblitz with reproduction?

You can use one of starter templates:
Plunkr: https://plnkr.co/edit/0NipkZrnckZZROAcnjzB?p=preview
StackBlitz: https://stackblitz.com/edit/ngx-bootstrap?file=app%2Fapp.module.ts

@marcotoldo
Copy link
Author

Hi,

I exported from stackblitz a minimal code that reproduce the problem (please refer to attached archive and attached screenshots)

Brief explanation:

  • when selecting a day in current month (november) everything is ok
  • when opening the datepicker and moving to previous month (october) selected object date is previous day at 22:00:00
  • when opening the datepicker and moving to next month (december) selected object date is previous day at 23:00:00

Thank you

ngx-bootstrap.zip
previous_month
next_month

@valorkin valorkin added this to the v2.0.0-rc.2 milestone Jan 11, 2018
@kaustubhnerurkar
Copy link

This issue still appears in version 2.0.1

@newbeewan
Copy link

newbeewan commented Mar 21, 2019

It's still here in the 3.3.0 version, could you check it ?

If I choose a date in the datepicker -> everything work well,
If I put manually the date (in the good format), the value is converted to date - 1day.

For example if I put 01/03/2019 it become 28/02/2019 in the model, but the 01/03/2019 is shown ( dateInputFormat: 'DD/MM/YYYY')

[edit] I found that the date is transform to UTC... We are in UTC+1 so the real date is 2019-03-01 00:00:00 and it is converted to 2019-02-28 23:00:00 when I'm submitting the form... Is ther any possibiliy to avoid that ?

@rvmladenov
Copy link

rvmladenov commented Aug 20, 2020

Confirming that it is still there. WTH 👎 v^5.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants