jsDatePick - Using a Selected Date

不想你离开。 提交于 2019-12-01 13:51:31

I had the same problem and found the following solution from a post by this German fellow (http://www.viathinksoft.de/?page=news&id=184). The post is in German and if you translate it in English, it messes up the code he provided so copy the code first or you can copy below. Here's his fix, you need to modify "jsDatePick.full.1.3.js" script, function "setConfiguration" with the following:

 this.selectedDayObject = {};
 this.flag_DayMarkedBeforeRepopulation = false;
 this.flag_aDayWasSelected = false;
 this.lastMarkedDayObject = null;

 if (!this.oConfiguration.selectedDate){
      this.currentYear      = this.oCurrentDay.year;
      this.currentMonth     = this.oCurrentDay.month;
      this.currentDay          = this.oCurrentDay.day;
 } else {
      this.currentYear      = this.oConfiguration.selectedDate.year;
      this.currentMonth     = this.oConfiguration.selectedDate.month;
      this.currentDay          = this.oConfiguration.selectedDate.day;
      this.selectedDayObject = this.oConfiguration.selectedDate;
      this.flag_aDayWasSelected = true;                                   
 }

Basically, he added the "else" condition and actions to the code.

In your HTML, you need to use "jsDatePick.full.1.3.js".

Hope this helps.

When uncommenting the selected date part, did you add a , at the end of cellColorScheme:"beige" ? If no, you'll get a syntax error.

I had the same problem, and mine was on an edit page so I need to set for the record being edited in the jsDatePick date and have that appear in the target textbox (I couldn't just set the date in the textbox, this caused the NaN issue in the first place). So my resolution is an extension of Cesar's one:

this.selectedDayObject = {};  
this.flag_DayMarkedBeforeRepopulation = false;  
this.flag_aDayWasSelected = false;  
this.lastMarkedDayObject = null;


 if (!this.oConfiguration.selectedDate){
      this.currentYear      = this.oCurrentDay.year;
      this.currentMonth     = this.oCurrentDay.month;
      this.currentDay          = this.oCurrentDay.day;  } else {
      this.currentYear      = this.oConfiguration.selectedDate.year;
      this.currentMonth     = this.oConfiguration.selectedDate.month;
      this.currentDay          = this.oConfiguration.selectedDate.day;
      this.selectedDayObject = this.oConfiguration.selectedDate;
      this.flag_aDayWasSelected = true; 
      this.populateFieldWithSelectedDate();
}

This causes an issue in the closeCalendar function, which needs to be changed to:

JsDatePick.prototype.closeCalendar = function () {
    if (this.JsDatePickBox) {
        this.JsDatePickBox.style.display = "none";
        document.onclick = function() {};
    }
};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!