Hybrid View
-
24 Feb 2011 2:45 AM #1
[FIXED]DateField parsing/formatting problem
[FIXED]DateField parsing/formatting problem
I have the following DateField in a form
The date comes from the server like this: date: "2009-12-13T23:00:00Z"PHP Code:xtype: 'datefield',
fieldLabel: 'Datum',
name: 'date',
boxMaxWidth: 120,
format: 'd.m.Y',
altFormats: 'c'
Because I´m located in Germany (GMT+0100) I would expect to see the date "14.12.2009" but the datefield displays "13.12.2009".
I assume that the datefield does not correctly parse/format the date according to my timezone.
Beside the form which shows one record I list all records from backend in a gridpanel. Here the date is displayed like expected.
PHP Code:{
xtype: 'dateheader',
text: 'Datum',
dataIndex: 'date',
format: 'd.m.Y H:i:s Z',
flex: 1
},
-
24 Feb 2011 3:33 AM #2
You specify the format as d.m.Y, which means that's how it will get parsed. The TZ information is ignored.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Feb 2011 3:53 AM #3
as I understood the docu the datefield first tries to parse the date according to the pattern of the format property. If this does not return a valid date it takes all of the altFormats patterns.
Here I defined 'c' which is fulfilled by the date sent from the backend.
If I set altFormats in my example to 'd.m.Y' the date can't be parsed and the datefield is empty.
-
24 Feb 2011 4:11 AM #4
Duh, sorry I misread. Yeah I think you're right, I recall a fix going in for 3.x related to this.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Feb 2011 4:31 AM #5
Ok, I've added a fix. Not sure which release it will go into quite yet, but when I run the code it parses as the 14th.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Feb 2011 4:56 AM #6
Thanks a lot.
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[CLOSED][3.0.0] Date parsing and formatting not turned off.
By JSCoder in forum Ext 3.x: BugsReplies: 11Last Post: 18 Oct 2009, 8:49 AM -
Ext.form.DateField - formatting ignored?
By fruitwerks in forum Ext 3.x: Help & DiscussionReplies: 11Last Post: 15 Aug 2009, 11:22 AM -
<SOLVED> Parsing Arraydata into DateField
By wvmaaren in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 10 Jul 2009, 3:25 AM -
Datefield Auto Formatting
By twilsonxpert in forum Ext 2.x: Help & DiscussionReplies: 11Last Post: 12 May 2008, 7:52 AM -
[SOLVED] dateField formatting problem
By catacaustic in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 9 Aug 2007, 3:28 PM


Reply With Quote