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 shows correct date after selection but the actual value is different , it adds 22H in time #4464

Closed
arangates opened this issue Jun 26, 2018 · 1 comment

Comments

@arangates
Copy link

arangates commented Jun 26, 2018

Bug description or feature request:

i use BsConfig dateInputFormat : "DD-MM-YYYY" .

if i select a date it shows correct date for eg: i select 2018-07-26

actual value 2018-07-25T22:00:00.000Z

expected value 2018-07-26T00:00:00.000Z

what i found is the day is reduced by 1 and it adds 22 hours in time. How to fix this ?

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap:^3.0.1

Angular:6.0.0

Bootstrap:4.1.1

Build system: Angular CLI

@ghost
Copy link

ghost commented Nov 2, 2018

@arangates this is due to the timezone component in the Date. You can you something like this
const utcDate = new Date(Date.UTC( your_date.getFullYear(), your_date.getMonth(), your_date.getDate(), your_date.getHours(), your_date.getMinutes())); const resultDate = Json.stringify(utcDate);

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

2 participants