js比较日期大小(年月日、月日)

let nowMonthDay = tool.getNowMonthDay();
let _nowMonthDay = new Date(nowMonthDay.replace(/-/g, "/"));
var MayStart = new Date('05-15'.replace(/-/g, "/"));
var MayEnd = new Date('05-30'.replace(/-/g, "/"));
var NovStart = new Date('11-15'.replace(/-/g, "/"));
var NovEnd = new Date('11-30'.replace(/-/g, "/"));
if (!((MayStart < _nowMonthDay < MayEnd) || (NovStart < _nowMonthDay < NovEnd))) {
  util.warning("提示信息!");
  return false;
}

注释:日期按照格式化进行输入,也可以写成年月日例如:2020-01-01

你可能感兴趣的:(VUE)