Hi,
I need to set the year from the birthdate, month and day is setting the values correctly while the year is reading it right but don't set it. why ?
below is my script,
thank you
//==== Start OF: GetBirthdate============================================================= function GetBirthdate() { debugger; if(Xrm.Page.getAttribute("new_birthdate").getValue() != null) { var dateFieldValue= Xrm.Page.getAttribute('new_birthdate').getValue(); var year = dateFieldValue.getFullYear(); var month = dateFieldValue.getMonth()+1; var day = dateFieldValue.getDate(); //var dateOnly = new Date(year,month+1,day); Xrm.Page.getAttribute("new_birthday").setValue(day); Xrm.Page.getAttribute("new_birthmonth").setValue(month); Xrm.Page.getAttribute("new_birthyear").setValue(year); } else { Xrm.Page.getAttribute("new_birthday").setValue(null); Xrm.Page.getAttribute("new_birthmonth").setValue(null); Xrm.Page.getAttribute("new_birthyear").setValue(null); } }// end of function //==== END OF: Fill Birthday,BirthMonth and Birthyear if birthdate is filled
↧
Javascript getting year from date
↧









