Date on iOS device returns NaN

Fixed this thanks to @Ian his comment ,

changed this:

var actiondate = new Date(date);

to this:

var t = date.split(/[- :]/);

// Apply each element to the Date function
var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);
var actiondate = new Date(d);

The reason of the problem is iPhone Safari doesn't support the Y-m-d H:i:s (ISO 8601) date format. I have encountered this problem in 2017/7/19, I do not understand why Safari did not fix the problem after two years.

I refer to the answer of Sjoerd, thanks Sjoerd, just rewrite it to a function to do the date conversion when you have many date need to be processed. After you get a date(must be Y-m-d H:i:s format) from server, you could use the function convert the date to the format which iOS device could resolve and other browsers could resolve too.

function convertDateForIos(date) {
    var arr = date.split(/[- :]/);
    date = new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]);
    return date;
}

I encountered the problem when I write ajax for date, hope the solution will help others encountered the annoying problem.