function convertDateTimeFromUTCtoLocalForTable() {
$("td[data-ConvertUTCToLocal]").each(function (i, el) {
if (el.innerHTML) {
var localDate = new Date(el.innerHTML + ' UTC');
el.innerHTML = localDate.toString("MM/dd/yyyy HH:mm"); //Method in data.js file , Remote URL http://www.datejs.com/build/date.js
}
});
$("span[data-ConvertUTCToLocal]").each(function (i, el) {
var localDate = new Date(el.innerHTML + ' UTC');
el.innerHTML = localDate.toString("MM/dd/yyyy HH:mm"); //Method in data.js file , Remote URL http://www.datejs.com/build/date.js
});
}
I am manipulating dates at run time.
I need to check if the expresion returns a valid date before i pass it to .toString
method.
Eg
if(IsvalidDate(localDate){
//Set value
}