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

Dustin Machi dmachi at dojotoolkit.org
Thu Jun 29 19:44:49 EDT 2006


look at dojo.date

Dustin


Kun Xi wrote:
> On 6/29/06, LiuCougar <liucougar at gmail.com> wrote:
>> On 6/29/06, Kun Xi <bookstack at gmail.com> wrote:
>> > 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 );
>> javascript 1.5/1.6 does not support this
>>
>> > Any idea to construct a Date object based upon input and format ?
>> You need to parse the input string yourself and feed that to Data
> 
> Sure, this is psudo code only. Since this bug results from the
> shortcoming of Date object. I just wondered whether there is already
> some effort to work around on Date enhancement.
> 
>>
>> -- 
>> "People's characters are strengthened through struggle against
>> difficulties; they are weakened by comfort."
>> - Old Chinese adage
>> _______________________________________________
>> dojo-contributors mailing list
>> dojo-contributors at dojotoolkit.org
>> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> 



More information about the dojo-contributors mailing list