js对比两个时间的大小
/** * 时间对比 开始=结束返回0;开始>结束返回-1;开始<结束返回1 */ function dateComparison(date1,date2){ var start =new Date(date1.replace(/-/g,"/").replace(/-/g,"/")); var end = new Date(date2.replace(/-/g,"/").replace(/-/g,"/")); if(start.getTime()==end.getTime()){ return 0; }else if (start.getTime()>end.getTime()){ return -1; }else if(start.getTime()<end.getTime()){ return 1; } }
本文来自博客园,作者:bigroc,转载请注明原文链接:https://www.cnblogs.com/bigroc/p/9049476.html
blog:http://www.bigroc.cn 博客园:https://www.cnblogs.com/bigroc