Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

Ion-datetime - Having issues with local timezone in picker

$
0
0

Hi All, I have upgraded to the new Ionic 6 and migrating to the new ion-datetime component. I am having an issues when passing a UTC to the datetime component. For example if I pass the value:
testDate = "2021-12-16T18:54:00+00:00"

<ion-item class="ion-text-wrap" button="true" id="ionic-date-contact-start">
                        <ion-icon name="calendar" slot="start"></ion-icon>
                          <ion-label style="color:#424242">Start Date</ion-label>
                          <ion-text>{{testDate|date:'mediumDate'}}</ion-text>
                        <ion-popover trigger="ionic-date-contact-start" show-backdrop="false">
                          <ng-template>
                            <ion-datetime
                              #popoverDatetime
                              presentation="date"
                              [(ngModel)]="testDate"
                              [showClearButton]="true"
                            ></ion-datetime>
                          </ng-template>
                        </ion-popover>
                      </ion-item>

When I open the datepicker, the solid circle should default to date passed.

The problem with above is it shows the UTC day not my local day which is a day after the UTC day. I am currently in Australian time which is +10hrs from the UTC. This means UTC 16 Dec, 1:54am should be:
Dec 17, 2021

Is anyone else having this issue. Is this a legitimate bug or am I doing something wrong?

The best way to test is passed a UTC datetime which lands on a different day for your local time zone.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>