I'm submitting a ... (check one with "x")
[x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
Current behavior
Current caleandar module doesn't have feature to pck UTC/local time.
Expected behavior
Would be vey useful to pick date in UTC timezone.
What is the motivation / use case for changing the behavior?
Sometimes it's needed to pick the date in UTC timezone, not in local.
I was looking at the source code and there actually is UTC date when you pick a date from calendar. But there is local date when you update it manually via input. This should be fixed to be consistent...
There should be a way to better handle timezone in Calendar. Currently, if you select a date from popup, input field is populated with a date that is one day earlier if local timezone is west of UTC. For instance, Argentina is -3 GMT and selecting 03/05/2017 will be shown as 03/04/2017 in field and value.
@dags Here are no problem with any timezone when date will be picked in UTC timezone because it always will be 00:00Z.
There is utc property for this.
The utc property doesn't work for me.
I'm using the calendar module of [email protected] in my Angular2 App template like this
<p-calendar [(ngModel)]="requestFrom" (onSelect)="onRequestDateTimeRangeChange()" [inputId]="requestFrom" [showTime]="true" [utc]="true"></p-calendar>
While having utc set to true I'd expect both the time in the input field and the ngModel value in my Angular component displayed and returned in UTC. Unfortunately it seems like that property is not working at all as the input field displays my local time and when I return the value in my component I get
console.log(this.requestFrom); // Wed Jul 19 2017 11:36:36 GMT+0200 (CEST)
@cagataycivici any idea how to solve that?
@alexschilpp this is my expectation exactly. I just commented on #3611 since that issue is still open and might hopefully be resolved.
It seems that utc property still exists but it's not used any more in Calendar. If i set it I see this message in the console:
Setting utc has no effect as built-in UTC support is dropped.
Most helpful comment
The
utcproperty doesn't work for me.I'm using the calendar module of [email protected] in my Angular2 App template like this
<p-calendar [(ngModel)]="requestFrom" (onSelect)="onRequestDateTimeRangeChange()" [inputId]="requestFrom" [showTime]="true" [utc]="true"></p-calendar>While having
utcset to true I'd expect both the time in the input field and the ngModel value in my Angular component displayed and returned in UTC. Unfortunately it seems like that property is not working at all as the input field displays my local time and when I return the value in my component I getconsole.log(this.requestFrom); // Wed Jul 19 2017 11:36:36 GMT+0200 (CEST)