PDA

View Full Version : [Solved] DatePicker initial value error?



Marbh Maidin
7 Aug 2007, 2:15 AM
Hello. I've tried to configure DatePicker with initial value. But I've got error messages only.

Error: _1.value.clearTime is not a function
Source File: /javascript/ext-all.js
Line: 120

I've looked in the file DatePicker.js (source) and this part in line 20/21 seems wrong to me.

this.value = config && config.value ?
config.value.clearTime() : new Date().clearTime();

I am Javascript (and english :) novice, but this fixed my problem.

this.value = config && config.value ?
new Date(config.value).clearTime() : new Date().clearTime();

mystix
7 Aug 2007, 2:31 AM
8887

mystix
7 Aug 2007, 2:36 AM
this is not a bug.

if you refer to the docs for the DatePicker's setValue (http://extjs.com/deploy/ext/docs/output/Ext.DatePicker.html#setValue) method, you'll see that it's supposed to accept a Date object.

that said, the documentation is missing the config option value.
the docs should probably state that Ext.DatePicker requires the value config to be a valid Date object.

i've updated the missing docs thread (http://extjs.com/forum/showthread.php?t=10476) with this report.

thanks for reporting this. :)

Marbh Maidin
7 Aug 2007, 2:55 AM
Now I understand and DatePicker works fine :)

mystix
9 Aug 2007, 9:05 AM
i've just been informed that value is not a public config, but a private variable.
you should get and set the DatePicker's value via the public methods getValue and setValue instead.

hope this helps.