View Full Version : [FIXED-457] New Slider/TimeField bugs?

17 Dec 2009, 10:48 AM
I'm finding a couple of error while trying out the new release of ExtJS 3.1.0.

Whenever I go to use setValue with a slider component now it will through a constrain is undefined in extjs-debug.js line 15899 error unless I parse the value as an int first. Didn't have to do this before.

Also the time validation for a timefield is now off.

You'll notice in this screenshot it is marking my field as invalid because it is not equal to or before 11:00 PM when it actually is.


17 Dec 2009, 11:07 AM
Please consider reading this and editing your post.


17 Dec 2009, 11:16 AM
Sorry, let me try it again.

Ext version tested: Ext 3.1.0

Browser versions tested against:
Google Chrome (Mac)
Safari 4

Operating System:
Mac OS X 10.6.2

When using the setValue method on a slider, I am getting the following error.

TypeError: Result of expression 'newValue.constrain' [undefined] is not a function. ext-all-debug.js:15988

Screenshot or Video:

Debugging already done:
I've found that everytime I go to set the value of a slider if I multiply it by 1 before I do so it works fine.

Possible fix:
convert the value being passed into to an int

17 Dec 2009, 11:28 AM
Ext version tested: Ext 3.1.0

Browser versions tested against:
Google Chrome (Mac)
Safari 4

Operating System:
Mac OS X 10.6.2

My timefields were working in previous versions, but after upgrading I found the validator marked valid timefields invalid.

Screenshot or Video:

Debugging already done:
None, if I get rid of the min and max values it doesn't have any problems, but that is because there are no longer any validation rules.

18 Dec 2009, 4:32 AM
For the TimeField problem:

The date of minValue and maxValue is now set to initDate, but validateValue uses the current day instead of initDate, so all minValue and maxValue checks are wrong.

You can temporary work around the problem by adding the following line to your timefield config:

initDate: new Date()
(note: validation will still fail if the application is started on day 1 and used on day 2 - but this was also the case in Ext 3.0)

18 Dec 2009, 9:26 AM
@condor -- that may result in the inifinite looping bug in timezones which experience DST.

the problem lies not in DateField#validateValue() using the current date, but in DateField#parseDate() parsing the TimeField value in the context of the current day.
TimeField needs its own parseDate() method to parse dates in the context of the date specified in initDate.

try this instead:
(note: there's an unreported bug which i just spotted in TimeField#setLimit(). fix included)

// *** first suggested in 309913 to solve the TimeField DST bug
Ext.override(Ext.form.TimeField, {
// *** private
initDateFormat: 'j/n/Y',

parseDate: function(value) {
if (!value || Ext.isDate(value)) {
return value;

var id = this.initDate + ' ',
idf = this.initDateFormat + ' ',
v = Date.parseDate(id + value, idf + this.format), // *** handle DST. note: this.format is a TIME-only format
af = this.altFormats;

if (!v && af) {
if (!this.altFormatsArray) {
this.altFormatsArray = af.split("|");
for (var i = 0, afa = this.altFormatsArray, len = afa.length; i < len && !v; i++) {
v = Date.parseDate(id + value, idf + afa[i]);

return v;

setLimit: function(value, isMin, initial) {
var d;

if (Ext.isString(value)) {
d = this.parseDate(value);
} else if(Ext.isDate(value)) {
d = value;

if (d) {
var val = new Date(this.initDate).clearTime();

// *** why use 59 seconds as the upper limit for the maxValue?
// we should use ALL time values (e.g. hours, minutes, seconds & milliseconds) from the minValue
val.setHours(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());

this[isMin ? 'minValue' : 'maxValue'] = val;
if (!initial) {

// *** no longer required -- let the TimeField's superclass (i.e. the ComboBox) handle beforeBlur()
//*** i.e. select a value from the Store
// by @mystix -- 337620
beforeBlur: Ext.form.TimeField.superclass.beforeBlur

Additionally, the docs need to state clearly that when specifiying minValue / maxValue using a javascript Date object, the javascript Date object which is used for initialisation should

be initialised with the same date values (e.g. day, month and year) as the TimeField's initDate config 1st day of the year (e.g. new Date(2008, 0, 1), and
have its time values (i.e. hours, minutes, seconds and milliseconds) set to a known value, or cleared altogether using Date#clearTime()

18 Dec 2009, 9:32 AM
I am assuming a fix will be posted in the SVN then?

18 Dec 2009, 9:35 AM
@charleshimmer: that's just my suggested override.

it needs to be reviewed by the dev team -- they'll decide what code makes its way into svn.

p.s have you tried the override yet? does it work/solve your problem?

19 Jan 2010, 2:56 PM

Is there any new information about this?


22 Jan 2010, 2:57 PM
Why does this even run a validator? min/maxValue determine what choices are in the dropdown, and you can't type into that field anyway so I don't see how the time could ever possibly be out of the range of min/max.

Jamie Avins
10 Feb 2010, 5:56 PM
Updated in svn 3.2.x branch.