PDA

View Full Version : Datefield setValue\getValue functions



ralfius
20 Nov 2012, 1:49 AM
Hello,
looks like I have found some kind of bug in Ext.form.field.Date behavior in ExtJS 4.1.2. I have a datefield:

Ext.define('MyDateField', {
extend: 'Ext.form.field.Date',
alias: 'widget.myDateField',
format: 'm/d/Y',
maskRe: /[0-9\/: ]/,
enforceMaxLength: true,
maxLength: 16
});
When I'm trying to set value of this datefield using setValue() method, if the Date object is having some time different from 00:00:00, it makes datefield's time 00:00:00 with the same date and timezone.
Example: if use datefield.setValue(new Date("Wed Dec 07 1960 23:00:00 GMT+0200 (FLE Standard Time)"), after that datefield.getValue() returns Wed Dec 07 1960 00:00:00 GMT+0200 (FLE Standard Time). Could you please give some solution for this problem?

Thanks

Farish
20 Nov 2012, 3:58 AM
if you change your format to include time parameters as well e.g.


format: 'm/d/Y H:i:s',

then it works but you will also see the time in the datefield then...

ralfius
20 Nov 2012, 5:16 AM
Thanks for your answer! It works.
Is there possibility to not shown time and have correct datefield behavior?

Farish
20 Nov 2012, 5:43 AM
I am sorry I dont know. you may try to look in the API Docs and try with renderTpl or something to make it work like you want.