[dojo-contributors] How to construct Date object from string?

Kun Xi bookstack at gmail.com
Thu Jun 29 14:15:03 EDT 2006


Hi all,

I checked the Ticket #1008, "dropdowndatepicker can't handle other
date formats" in the trac, and find the problem is caused by
DropdownDatePicker.js, Ln 47:

		onInputChange: function(){
Ln:47		var tmp = new Date(this.inputNode.value);
			this.datePicker.date = tmp;
			this.datePicker.setDate(dojo.widget.DatePicker.util.toRfcDate(tmp));
			this.datePicker.initData();
			this.datePicker.initUI();
		}
Here, the tmp is constructed from the input field regardless the input
format, it is might be easier to fix this bug, if the following
function is supported:

var tmp = new Date( this.inputNode.value, this.dateFormat );

Any idea to construct a Date object based upon input and format ?

Best regards,
Kun Xi



More information about the dojo-contributors mailing list