sessionStorage.setItem("taskConfigs",JSON.stringify(temp))
发现存入sessionStorage中的时间 出现减1的显现 本以为是sessionStorage的存储问题 后来发现是JSON.stringify的问题
可以将时间转换成字符串,这样存进去再取出来就没问题了
附上年月日的转换方式
export function yymmdd (time) {
let date;
if (isNull(time)) {
date = new Date();
} else {
date = new Date(time);
}
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = (date.getDate()).toString().padStart(2, '0');
return (`${year}-${month}-${day}`);
}