Remember the problems and solutions you encountered during development:
When doing form validation, you need to verify that the time and date is greater than today. Then compare the date selected by the calendar plugin with the current date.
code show as below:
//The date selected by the calendar plugin var date = that.data.dateNumber; var selectDate = Date.parse(date); //current time var nowData= Date.parse(new Date()); //Compare and assign the comparison result to isDate var isDate = selectDate > nowData;
Then, I found that Android can get the results normally but not under the IOS system. The result of the study is that IOS does not support the time format "YYYY-MM-DD", which is converted to a timestamp: NAN. The solution is as follows:
var date = that.data.dateNumber; var selectDate = Date.parse(date.replace(/-/g, '/')); var nowData= Date.parse(new Date()); var isDate = selectDate > nowData;
By replacing "-" in the "YYYY-MM-DD" time format with "/", IOS will recognize it. Note: date is a string type. (Thinking for a long time, whispering, the root cause is still because of the dishes...)