JS实现IOS时间格式转yyyy-mm-dd格式
/**
* IOS时间格式转yyyy-mm-dd格式
*@param iosDate [IOS时间格式]
*@return {string} [yyyy-mm-dd]
**/
const convertIOSDateFormat = (iosDate) => {
if(!iosDate) {
return '-';
}
const date = new Date(iosDate);
const year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month < 10) {
month = `0${month}`;
}
if (day < 10) {
day = `0${day}`;
}
return `${year}-${month}-${day}`;
}