js比较两个时间的大小demo效果(整理)

// 比较时间大小
 compareDate(date1,date2){
    
    
     var oDate1 = new Date(date1);
     var oDate2 = new Date(date2);
     if(oDate1.getTime() > oDate2.getTime()){
    
    
         return true; //第一个大
     } else {
    
    
         return false; //第二个大
     }
 },

this.compareDate(new Date(),‘2019-01-22’)

猜你喜欢

转载自blog.csdn.net/qq_38881495/article/details/128774614