Specified date not showing


#1

right calendar showing current date (active date) only.

rdcCalObj.leftCalendar.setDateFormat("%m/%d/%Y");
rdcCalObj.leftCalendar.setDate($("#rdc-eff-date").val()||null);
rdcCalObj.rightCalendar.setDateFormat("%m/%d/%Y");
rdcCalObj.rightCalendar.setDate(new Date(2011,5,8))

a date which one I want to set only reflect in a left calendar. after that it will be showing an error i.e. TypeError: Cannot set property ‘innerHTML’ of undefined


#2

Your service should have like this :

FormatDate(iDate: Date) {
   var inputDate = new Date(iDate);
   var formattedDate = inputDate.getFullYear()+'-'+(inputDate.getMonth() + 1)+'-'+ 
   inputDate.getDate();
   return formattedDate;
}

And In your ts file should have like this :

let newDate = new Date(this.CustomerVM.customer.CustomerDob);
this.CustomerVM.customer.CustomerDob = this.Helper.FormatDate(newDate);

#3

i do not have any ts file… i have only js file.


#4

var processCalendar = function() {
var rdcCalObj = new dhtmlXDoubleCalendar(“rdc-comp-cont”);
rdcCalObj.attachEvent(“onClick”, function(side, date) {
rdcCalObj.setDateFormat("%m/%d/%Y");
if (side == ‘left’) {
$("#rdc-eff-date").val(getMMDDYYYY(date));
} else {
$("#rdc-exp-date").val(getMMDDYYYY(date));
rdcCalObj.hide();
}
});
rdcCalObj.rightCalendar.setPosition(“right”);
rdcCalObj.leftCalendar.setPosition(“right”);
$("#rdc-eff-date,#rdc-exp-date").on(“click”,function() {

							rdcCalObj.show();
						    //rdcCalObj.setDates($("#rdc-eff-date").val()||null, $("#rdc-exp-date").val()||null);
							rdcCalObj.leftCalendar.setDateFormat("%m/%d/%Y");
							rdcCalObj.leftCalendar.setDate($("#rdc-eff-date").val()||null);
							rdcCalObj.rightCalendar.setDateFormat("%m/%d/%Y");
							rdcCalObj.rightCalendar.setDate($("#rdc-eff-date").val()||null);
							var cssChange = parseInt($(
									"#rdc-comp-cont .dhtmlxcalendar_dhx_terrace:nth-child(2)")
									.css("margin-left")) + 15;
							$(
									"#rdc-comp-cont .dhtmlxcalendar_dhx_terrace:nth-child(2)")
									.css('margin-left', cssChange + "px");
						}).on("blur", function() {
					rdcCalObj.hide();
				});
		$("#rdc-comp-cont .dhtmlxcalendar_time_cont").html(
				"<span class='cal-reset'>Reset</spna>").css("display",
				"block");
		$(
				"#rdc-comp-cont .dhtmlxcalendar_dhx_terrace:nth-child(1) .cal-reset")
				.on("click", function() {
					$("#rdc-eff-date").val("");
				});
		$(
				"#rdc-comp-cont .dhtmlxcalendar_dhx_terrace:nth-child(2) .cal-reset")
				.on("click", function() {
					$("#rdc-exp-date").val("");
				});

	
}

#5

In case of using the double calendar you should define the value for both calendar objects at one:
https://docs.dhtmlx.com/api__dhtmlxdoublecalendar_setdates.html