Ionic 4: Native DatePicker disable UTC time adjustment

This should be simple but I’m not seeing anything in the API docs as such.

date = '2019-08-15T09:21:00';

async presentDatePicker() {
      mode: 'datetime',

      date => { = date.toISOString();
      err => console.log(err)

The date should read Aug 15, 9:21 AM. Which it does on our web client and in our databases. However, in the picker, it reads Aug 15 4:21 AM. As I understand, it’s doing this because of the time zone offset. But for the intents of this application we don’t care about the time zone, just that the time reports and displays the same on all devices.

Is there a way to disable this feature?

Where you able to disable the conversion?

No I was not. I just ended up treating dates as string literals on my backend. Not ideal solution but I’ve chased too many ghosts by digging under the hood of Ionic.

1 Like

I wonder if adding an explicit time zone designator to the string would make any difference (such as ‘Z’).

In my experience nothing worked reliably. Chrome would behave differently from Safari, and then it would behave differently once actually built into a native package.

The only thing that worked reliably across all devices, was to store the raw date string in the DB in tandem with the Moment.js library.