DateField.js (tine20-2020.08.3) | : | DateField.js (tine20-2020.08.4) | ||
---|---|---|---|---|
skipping to change at line 139 | skipping to change at line 139 | |||
*/ | */ | |||
'select' | 'select' | |||
); | ); | |||
if(Ext.isString(this.minValue)){ | if(Ext.isString(this.minValue)){ | |||
this.minValue = this.parseDate(this.minValue); | this.minValue = this.parseDate(this.minValue); | |||
} | } | |||
if(Ext.isString(this.maxValue)){ | if(Ext.isString(this.maxValue)){ | |||
this.maxValue = this.parseDate(this.maxValue); | this.maxValue = this.parseDate(this.maxValue); | |||
} | } | |||
if ((this.value === undefined || this.value === null) && this.default == | ||||
= 'CURRENT_TIMESTAMP') { | ||||
this.value = this.fullDateTime = new Date().clearTime(); | ||||
} | ||||
this.disabledDatesRE = null; | this.disabledDatesRE = null; | |||
this.initDisabledDays(); | this.initDisabledDays(); | |||
}, | }, | |||
initEvents: function() { | initEvents: function() { | |||
Ext.form.DateField.superclass.initEvents.call(this); | Ext.form.DateField.superclass.initEvents.call(this); | |||
this.keyNav = new Ext.KeyNav(this.el, { | this.keyNav = new Ext.KeyNav(this.el, { | |||
"down": function(e) { | "down": function(e) { | |||
this.onTriggerClick(); | this.onTriggerClick(); | |||
}, | }, | |||
skipping to change at line 270 | skipping to change at line 273 | |||
// Provides logic to override the default TriggerField.validateBlur which ju st returns true | // Provides logic to override the default TriggerField.validateBlur which ju st returns true | |||
validateBlur : function(){ | validateBlur : function(){ | |||
return !this.menu || !this.menu.isVisible(); | return !this.menu || !this.menu.isVisible(); | |||
}, | }, | |||
/** | /** | |||
* Returns the current date value of the date field. | * Returns the current date value of the date field. | |||
* @return {Date} The date value | * @return {Date} The date value | |||
*/ | */ | |||
getValue : function(){ | getValue : function(){ | |||
return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) | // return this.parseDate(Ext.form.DateField.superclass.getValue.call(thi | |||
|| ""; | s)) || ""; | |||
// return the value that was set (has time information when unchanged in | ||||
client) | ||||
// and not just the date part! | ||||
var value = this.fullDateTime; | ||||
return value || ""; | ||||
}, | }, | |||
/** | /** | |||
* Sets the value of the date field. You can pass a date object or any stri ng that can be | * Sets the value of the date field. You can pass a date object or any stri ng that can be | |||
* parsed into a valid date, using <tt>{@link #format}</tt> as the date form at, according | * parsed into a valid date, using <tt>{@link #format}</tt> as the date form at, according | |||
* to the same rules as {@link Date#parseDate} (the default format used is < tt>"m/d/Y"</tt>). | * to the same rules as {@link Date#parseDate} (the default format used is < tt>"m/d/Y"</tt>). | |||
* <br />Usage: | * <br />Usage: | |||
* <pre><code> | * <pre><code> | |||
//All of these calls set the same date value (May 4, 2006) | //All of these calls set the same date value (May 4, 2006) | |||
skipping to change at line 296 | skipping to change at line 304 | |||
dateField.setValue('05/04/2006'); | dateField.setValue('05/04/2006'); | |||
//Pass a date string (custom format): | //Pass a date string (custom format): | |||
dateField.format = 'Y-m-d'; | dateField.format = 'Y-m-d'; | |||
dateField.setValue('2006-05-04'); | dateField.setValue('2006-05-04'); | |||
</code></pre> | </code></pre> | |||
* @param {String/Date} date The date or valid date string | * @param {String/Date} date The date or valid date string | |||
* @return {Ext.form.Field} this | * @return {Ext.form.Field} this | |||
*/ | */ | |||
setValue : function(date){ | setValue : function(date){ | |||
/** | ||||
* fix timezone handling for date picker | ||||
* | ||||
* The getValue function always returns 00:00:00 as time. So if a form g | ||||
ot filled | ||||
* with a date like 2008-10-01T21:00:00 the form returns 2008-10-01T00:0 | ||||
0:00 although | ||||
* the user did not change the fieled. | ||||
* | ||||
* In a multi timezone context this is fatal! When a user in a certain t | ||||
imezone set | ||||
* a date (just a date and no time information), this means in his timez | ||||
one the | ||||
* time range from 2008-10-01T00:00:00 to 2008-10-01T23:59:59. | ||||
* _BUT_ for an other user sitting in a different timezone it means e.g. | ||||
the | ||||
* time range from 2008-10-01T02:00:00 to 2008-10-02T21:59:59. | ||||
* | ||||
* So on the one hand we need to make sure, that the date picker only re | ||||
turns | ||||
* changed datetime information when the user did a change. | ||||
* | ||||
* @todo On the other hand we | ||||
* need adjust the day +/- one day according to the timeshift. | ||||
*/ | ||||
// get value must not return a string representation, so we convert this | ||||
always here | ||||
// before memorisation | ||||
if (Ext.isString(date)) { | ||||
var v = Date.parseDate(date, Date.patterns.ISO8601Long); | ||||
if (Ext.isDate(v)) { | ||||
date = v; | ||||
} else { | ||||
date = Ext.form.DateField.prototype.parseDate.call(this, date); | ||||
} | ||||
} | ||||
// preserve original datetime information | ||||
this.fullDateTime = date; | ||||
return Ext.form.DateField.superclass.setValue.call(this, this.formatDate (this.parseDate(date))); | return Ext.form.DateField.superclass.setValue.call(this, this.formatDate (this.parseDate(date))); | |||
}, | }, | |||
// private | // private | |||
parseDate : function(value){ | parseDate : function(value){ | |||
if(!value || Ext.isDate(value)){ | if(!value || Ext.isDate(value)){ | |||
return value; | return value; | |||
} | } | |||
var v = Date.parseDate(value, this.format); | var v = Date.parseDate(value, this.format); | |||
if(!v && this.altFormats){ | if(!v && this.altFormats){ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 52 lines changed or added |