MOBILE-3947 ion-datetime: Fix timestamp supplied to datetime
ion-datetime no longer uses time zone, it's always UTC now so we had to adapt the initial value supplied. No change needed when reading the value because moment automatically uses the user timezone if the value doesn't specify a timezone.main
parent
f100e59d10
commit
50b8fe2e98
|
@ -208,7 +208,11 @@ export class CoreTimeUtilsProvider {
|
|||
* @returns Formatted time.
|
||||
*/
|
||||
toDatetimeFormat(timestamp?: number): string {
|
||||
return moment(timestamp || Date.now()).toISOString();
|
||||
const isoString = moment(timestamp || Date.now()).toISOString(true);
|
||||
|
||||
// Remove milliseconds and timezone for consistency with the values used by ion-datetime.
|
||||
// ion-datetime no longer uses timezone, it always uses UTC.
|
||||
return isoString.substring(0, isoString.indexOf('.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue