/**
* @description 将date转为字符串:yyyy-MM-dd格式
* @author fzg
*/
export const dateToString = (date) => {
var Y = date.getFullYear();
var M = date.getMonth() + 1;
var D = date.getDate();
return Y + '-' + (M < 10 ? ('0' + M) : M) + '-' + (D < 10 ? ('0' + D) : D);
}
标签:MM,dd,JS,yyyy,var,字符串,date
From: https://www.cnblogs.com/Fantasyfzg/p/17027085.html