Having an Ionic 2 app, my challenge is to compare two dates. Initially, I have a date in string format like so: '2017-03-29 09:13:00'
My approach involves transforming it into a Date Object:
let myDate = new Date('2017-03-29 09:13:00');
The next step is comparing my date with the current day's date:
let today: Date = new Date();
let myDate = new Date('2017-03-29 09:13:00');
if(today == myDate) {
return something...
}
This code functions well with ionic serve and ionic run android (on an android device). The resulting date format is "Wed Mar 29 2017 09:13:00 GMT+0200 (Central Europe Daylight Time)"
However, I encountered some issues on IOS devices.
let myDate = new Date('2017-03-29 09:13:00');
yields 'null'
and
let today: Date = new Date();
gives me this date format: "2017-03-30T09:17:01.303Z"
I am puzzled by these inconsistencies and seeking guidance on how to obtain the correct Date type on IOS devices.