in tapestry-core/src/main/resources/META-INF/modules/t5/core/datepicker.js [368:418]
DatePicker.prototype.setDate = function (oDate, forceOnSelect)
{
// if null then set None
if (oDate == null)
{
//if _selectedDate isn't null, then this is an actual change...
//but if it /is/ null, we have to see if we were inited or not. If we weren't inited, then we're
//setting this to null now, and we shouldn't fire a select...
//but the problem occurs on subsequent... hm...
if (this._selectedDate != null)
{
this._selectedDate = null;
if (typeof this.onchange == "function")
this.onchange();
this.onselect();
} else if (forceOnSelect)
this.onselect();
//note: setDate must inherently set the calendar date
this._selectedInited=true;
this.setCalendarDate(null);
return;
}
// if string or number create a Date object
if (typeof oDate == "string" || typeof oDate == "number")
{
oDate = new Date(oDate);
}
// do not update if not really changed
if (this._selectedDate == null || !this._datesAreSame(this._selectedDate, oDate))
{
this._selectedDate = new Date(oDate);
if (typeof this.onchange == "function")
this.onchange();
//so if _selectedInited is false, then the value is different only because we set the value programmatically, post-initialization.
//that handles the creation + set event. Subsequent reveals will set it to whatever _selectedDate already was, so it's handled.
if (this._selectedInited)
this.onselect();
else
this._selectedInited=true;
} else if (forceOnSelect)
this.onselect();
//note: setDate must inherently set the calendar date
this.setCalendarDate(oDate);
}