js判断两个日期是否严格相差整年(合同日期常用)
1、var beginDate = new Date($("#InvoiceStartTime").val());
var endDate = new Date($("#InvoiceEndTime").val());
beginDate.setDate(beginDate.getDate()-1);
var diffYear = endDate.getFullYear() - beginDate.getFullYear();
if ($("#InvoiceViewModel_ContractPeriod").val() == diffYear && beginDate.getMonth() === endDate.getMonth()
&& beginDate.getDate() === endDate.getDate()) {}
2、js中date的操作方法 http://www.w3school.com.cn/jsref/jsref_obj_date.asp
3、自定义的date操作类 http://www.cnblogs.com/sunnycoder/archive/2010/03/16/1687641.html