-
13 Aug 2012 6:48 AM #1
Unanswered: Showing full date in date field
Unanswered: Showing full date in date field
Hi, I wish to show the full parsed date in a datefield. I effectively saw the date was always 01/01/01 for example.
As the application I'm developping targets from the baby to the elders, I might need to show the centuries in addition of what's already shown.
I'd be glad to know if there's a way to show : 01/01/1901.
Thanks in advance.
---------
I searched through documentation but I saw no property which could fit...
-
13 Aug 2012 7:00 AM #2
you need to set the "format" config of the datefield to show the date how you like it to be shown.
-
13 Aug 2012 7:01 AM #3
It shows the full year by default. See the live example in the docs. There is a format configuration you can define for alternate formats.
http://docs.sencha.com/ext-js/4-1/#!...ate-cfg-format
-
13 Aug 2012 7:02 AM #4
Use format config (see supported formats http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date) -
PHP Code:{
xtype: 'datefield',
format: 'm/d/Y'
}
-
13 Aug 2012 7:14 AM #5
Thank you for your quick answers, but I'm already using format config and it doesn't change anything... It desperately remains 01/01/01...

-
13 Aug 2012 7:16 AM #6
you probably have m/d/y (lowercase Y). If you just delete the format you should be set.
-
13 Aug 2012 7:19 AM #7
I'm sorry, but here's my code :
I'm actually using an upper Y... This is why I don't understand...Code:{ xtype: 'datefield', name: 'dateEffet', fieldLabel: 'Date d\'effet ', format: 'd/m/Y', labelWidth: 120, width: 379, allowBlank: false }
--------------------------------------
Maybe can help : I set its value with a getForm().setValues(res), res being an xhr answer array-parsed. I use it to fill my form, which this datefield belongs to. Can it be caused by this ? I'd precise when I show my form blank, I set its value with setValue(new Date()). Doesn't change anything though.Last edited by sencha-dev2; 13 Aug 2012 at 7:24 AM. Reason: precisions
-
13 Aug 2012 7:31 AM #8
Oh I see why you are using format now. The European way makes so much more sense. Is it possible it is getting overridden somewhere? d/m/Y should show it the way you want. In fact I even ran the code you specified just to double check and it works.
-
13 Aug 2012 7:32 AM #9
take a look at the altFormats config and the example in the API Docs:
http://docs.sencha.com/ext-js/4-0/#!...orm.field.Date
your value which you are setting to the datefield should be in one of the formats specified either in the format config or the altFormats config.
-
13 Aug 2012 7:44 AM #10
Had an idea. Are you using locale? The french locale has the d/m/y format specified. If you are including the locale script after your code it could be your issue.
--Edit
On second thought, I don't think locale would override a format specified on a object config, but I do wonder if it is somehow related. If you are using locale, try removing it temporarily and see if anything changes.


Reply With Quote