(一)IOS new Date()

IOS using new Date () appears situation Invalid Date, NaN-NaN, etc.

The reason: new Date (), new Date ( '2019-01-01'), new Date ( '2019-01-01 0:00:00') is not supported in IOS

However, a Date new new ( '2019-01-01 T 0:00:00') supported in the IOS format

 

public dates: Array<Date> = [];
this.dates.push(new Date('2019-08-25T15:29:44.459086'));
this.dates.push(new Date('2019-08-26 00:00:00'));
this.dates.push(new Date('2019-08-27'));
this.dates.push(new Date(Date.parse('2019-08-25T15:29:44.459086')));
this.dates.push(new Date(Date.parse('2019-08-26 00:00:00')));
this.dates.push(new Date(Date.parse('2019-08-27')));
this.dates.push(new Date(Date.parse('2019-08-25T00:00:00.000000')));
this.dates.push(new Date(Date.parse('2019-08-26T00:00:00.00000')));
this.dates.push(new Date(Date.parse('2019-08-27T00:00:00.000000Z')));
this.dates.push(new Date(Date.parse('2019-08-28T00:00:00.00000Z')));
this.dates.push(new Date(Date.parse('2019-08-29T00:00:00.000Z')));
this.dates.push(new Date());
let curr = new Date();
let str = `${TimeHelper.Date2String(curr, 'YYYY-MM-DD')}T00:00:00.000000`;
curr = new Date(Date.parse(str));
console.log(str);
this.dates.push(curr);
this.dates.push(new Date(new Date().toDateString()));
this.dates.push(new Date(`${TimeHelper.Date2String(new Date(), 'YYYY-MM-DD')}`));
this.dates.push(new Date(Date.parse('2019-08-26')));

Guess you like

Origin www.cnblogs.com/chendongbky/p/11416744.html
Recommended