I am using the new datetime component for alarms, and I want it initialized to the current time. When I pass the component an ISO string, it just shows the UTC time instead of the local time. It is 10:28 pm local time, but it is showing 2:28 am (UTC).
this.time= new Date().toISOString()
and
<ion-datetime displayFormat="h:mm a" pickerFormat="h mm a" [(ngModel)]="time"></ion-datetime>
Stop using moment. date-fns is much lighter and can work with either native Date objects or ISO8601 strings directly, instead of needing a dedicated object that is hard to work with.
In momentjs, we can…
receive “en-US” and “ll” and return “MMM D, YYYY”
receive “en-US” and “LL” and return “MMMM D, YYYY”
receive “id-ID” and “ll” and return “D MMM YYYY”
receive “id-ID” and “LL” and return “D MMMM YYYY”