var datef=new Date ("2017-2-22 06:23");
JavaScript new Date ("XXXX"), this short code is perfect for Android phones, but the iphone returns invalid date
Information found:
New Date ("2017-2-22 06:23") This time format is not supported on iOS systems
This format can only be changed to the new Date ("2017/2/22 06:23").
or such a format: New Date ("2017", "2", "22", "06", "23")
var datef= "2017-2-22 06:23"; JS does not provide a way to replace all replaceall. Replace all '-' using regular Expressions Datef=datef.replace (/-/g, "/");//ios only supports new date ("2017/2/22 06:23") format var suggest_date = new Date (DATEF) ;//Convert the difference in milliseconds to a number of days, var day = parsefloat ((suggest_date-new date ())/1000/60/60/24);
This article from the "10916470" blog, reproduced please contact the author!
Questions about the invalid date in iOS for new date