Ext.namespace('DsTruckRpt'); DsTruckRpt.MsCheckDate = function (mydate) { var e = Ext.Date.parse(mydate, 'Y-m-d'); //格式化日期控件值 var end = new Date(e); var start = new Date(); var elapsed = Math.round((end.getTime() - start.getTime())/(86400000)); // 计算间隔月数 // 得到系统日期 if (elapsed <= 30) { return 'check_red'; } else if (elapsed <= 60) { return 'check_orange'; } return ''; }