Here's how I populate a date field w/ 'now' - where the validation pattern is
date{YYYY-MM-DD}
code
var oRightNow=new Date();
oToday=new Date(oRightNow.getFullYear(),oRightNow.getMonth(),oRightNow.getDate()); // oToday is a global for other reasons
geDate.rawValue = fFormatDate(oToday);
with functions defined as...
function fFormatDate(oDate) {
var iMonth=oDate.getMonth()+1;
var iDay=oDate.getDate();
var iYear=oDate.getFullYear();
// return iMonth+"/"+iDay+"/"+iYear;
return iYear+"-"+fEnsure2Digits(iMonth)+"-"+fEnsure2Digits(iDay);
}
function fEnsure2Digits(number) { return (number < 10) ? '0'+number : number; }