Mini Program's problem of incompatibility between date and timestamp ios

Mini Program converts the date string in YYYY-MM-DD HH:MM:MM format into a timestamp, which is normal on Android, but not on ios. Do you have any solutions or experience


write that Mini Program has just solved this problem. Ios is not compatible. It is indeed a pit. Try the following method;
dateToTimestamp (dateStr) {

if (!dateStr) {
    return ''
}
let newDataStr = dateStr.replace(/\.|\-/g, '/')
let date = new Date(newDataStr);
let timestamp = date.getTime();
return timestamp

}

For

ios date, try this: YYYY/MM/DD HH:MM:MM

Menu