业务场景:js中根据yyyy-MM-dd格式的日期进行比较来动态显示相关图标的出现与否

var DS173305 = {
DS173305Grid: null,
initDataGrid: function () {
DS173305.DS173305Grid = $('#DS173305_Grid').grid({
actionHandler:DS173305.actionHandler,
fnRowCallback:DS173305.rowCallback
});
},
actionHandler:function(rowdata,coltype,row,col){
if(coltype=="edit"){
$.pdialog.open("供应商产品实际录入", Main.contextPath + "/DS173304/init", {
width: 800,
height: 550
},
{
entryMark : "2",
distMonth : rowdata.distMonth,
areaCode : rowdata.lgcsCode,
areaName : rowdata.lgcsName,
supplierCode : rowdata.suppCode,
supplierName : "临时数据", productName : rowdata.classesName,
currentHalfCode : rowdata.halfCodeZ,
planType : rowdata.pdStockType,
adjustDate : rowdata.inputDate,
})
};
if(coltype=="delete"){
$('#main-content').postUrl(Main.contextPath + "/DS173305/delete/", {
suppDsId : rowdata.suppDsId,
actualFlowId : rowdata.actualFlowId,
})};
},
rowCallback: function (tr, data) {
var $td = $(tr).children('td').eq(18);
var theB=$td[0].children[1];
var theA=$td[0].children[0]; var d = new Date();
var str = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
var dstr = new Date(str.replace(/-/g, "/")); var a = data.halfCodeA;
var astr = new Date(a.replace(/-/g, "/")); var i = data.inputDate.toString();
var istr = new Date(i.replace(/-/g, "/"));
if(istr-astr<0 || dstr-istr<0){
theA.style.visibility="hidden";
theB.style.visibility="hidden";
}
}
}
$(document).ready(function () {
// 初始化调用
DS173305.initDataGrid();
});

java代码里将date转化为指定格式为:

Date d = new Date();
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = sdf.format(d);
05-11 19:33