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

The UTC time format still does not work in the calendar. #4359

Closed
MaxBurda opened this issue Nov 6, 2017 · 7 comments
Closed

The UTC time format still does not work in the calendar. #4359

MaxBurda opened this issue Nov 6, 2017 · 7 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@MaxBurda
Copy link

MaxBurda commented Nov 6, 2017

Now the calendar displays only local time. The properties [utc]="true" does not work.
This can be seen from the example.
Please click on the link and choose any date.
https://stackblitz.com/edit/prime-ng-calendar?embed=1&file=app/calendar/calendar.component.html

  • Angular version: 5.0.0

  • PrimeNG version: 4.3.0

utc

@soares741
Copy link

soares741 commented Nov 7, 2017

I have similar issues with the UTC flag and the calendar.

Angular version: 4.0.0

PrimeNG version: 4.3.0

My date is: 11/11/2017 00:59:59:999+0100

In this image I have the flag UTC="true"
The date is displayed correctly on the input box but on the calendar it selects the day 11
The time isn't correct either in the calendar or input box

with utc flag

@MaxBurda
Copy link
Author

MaxBurda commented Nov 8, 2017

In my project, I use a workaround.
I use two dates.

The first (fixed) for display on the UI
this.dateFix = new Date(this.date.getTime() + (this.date.getTimezoneOffset() * 60 * 1000));

And the second (true) for sending to the server.
this.date = new Date(this.dateFix.getTime() - (this.date.getTimezoneOffset() * 60 * 1000));

https://stackblitz.com/edit/prime-ng-calendar-workaround?embed=1&file=app/calendar/calendar.component.ts

But this is an ugly way.
It would be nice if PrimeNG fixed this mistake.

@cagataycivici
Copy link
Member

Does it still happen with 5.0.0-RC?

@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Nov 17, 2017
@cagataycivici cagataycivici added this to the 5.0 milestone Nov 17, 2017
@cagataycivici cagataycivici self-assigned this Nov 17, 2017
@cagataycivici cagataycivici removed the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Nov 19, 2017
@cagataycivici cagataycivici modified the milestones: 5.0, 5.FUTURE Nov 19, 2017
@cagataycivici cagataycivici added the Status: Discussion Issue or pull request needs to be discussed by Core Team label Nov 19, 2017
@derandreasberger
Copy link

Hello @cagataycivici!
I pulled the latest source and tried out UTC functionality. The pull-request i just posted would fix the issues I was able to identify when using timestamps with primeng calendar. Please review and let me know what you think!
Thanks!

@cagataycivici cagataycivici removed this from the 5.FUTURE milestone Jan 15, 2018
@cagataycivici cagataycivici added this to the 5.2.0-RC2 milestone Jan 22, 2018
@cagataycivici cagataycivici added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Discussion Issue or pull request needs to be discussed by Core Team labels Jan 22, 2018
@cagataycivici
Copy link
Member

Merging, thanks.

cagataycivici pushed a commit that referenced this issue Jan 22, 2018
@nivasn
Copy link

nivasn commented Mar 9, 2018

image

image
image

The date issue still prevails, the p-calendar view still shows the previous date, Please review and let me know if there is any fix.

PrimeNg Version: 5.2.1
Anglar Version: 5.0.0

@fitness23
Copy link

In my project, I use a workaround.
I use two dates.

The first (fixed) for display on the UI
this.dateFix = new Date(this.date.getTime() + (this.date.getTimezoneOffset() * 60 * 1000));

And the second (true) for sending to the server.
this.date = new Date(this.dateFix.getTime() - (this.date.getTimezoneOffset() * 60 * 1000));

https://stackblitz.com/edit/prime-ng-calendar-workaround?embed=1&file=app/calendar/calendar.component.ts

But this is an ugly way.
It would be nice if PrimeNG fixed this mistake.

Thank you, thank you, thank you! I have been trying to fix this for 2 days straight. This works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

6 participants