当前位置:   article > 正文

js中判断两个时间的前后关系_js 两个日期前后关系

js 两个日期前后关系

判断函数

CompareDate(d1, d2) {

return ((new Date(d1.replace(/-/g, "\/"))) > (new Date(d2.replace(/-/g, "\/"))));

}

传入值,如果第一个值晚于第二个值则返回true,否则返回false

let current_time = "2007-2-2";

let stop_time = "2007-1-31";

console.log('判断两个时间', this.CompareDate(current_time, stop_time))

 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号