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

Selected Dates are not UTC Dates #547

Open
pigeonfield opened this issue Mar 7, 2024 · 1 comment
Open

Selected Dates are not UTC Dates #547

pigeonfield opened this issue Mar 7, 2024 · 1 comment

Comments

@pigeonfield
Copy link

Versions

  • Angular version:
  • component version:

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

  1. I select some date range with time:

image

  1. Then displaying in the console event emitted by date&time selection:

image

ISSUE: I am already getting local date time, instead of UTC time. So in my case (Europe/Vienna) I am actually getting +1h time when passing values further.

Stackblitz link
If applicable, add stackblitz link.

@MatteoGalletta
Copy link

Here's my ugly workaround:

StackBlitz

Essentially I'm parsing the UTC date as a local one (obtaining the correct one):

onChange(event: any) {
    this.selectedValue = event;

    this.selectedValue.startDate = moment(this.selectedValue.startDate.toDate().toISOString().substring(0, 23)); // new line
    this.selectedValue.endDate = moment(this.selectedValue.endDate.toDate().toISOString().substring(0, 23)); // new line

    console.log('on change event', event);
}

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

No branches or pull requests

2 participants