-
6 Sep 2012 11:40 AM #1
Date formatting is broken (4.1.1)
Date formatting is broken (4.1.1)
Ext version tested:
- Ext 4.1.1
Browser versions tested against:- Chrome
Description:
ExtJS's date formatter appears to be broken: 'time', 'timestamp', and 'u' all return invalid values. ('time' and 'timestamp' produce an - incomprehensible - alphanumeric string, and 'u' seems to produce "000" reliably.
Steps to reproduce the problem:- Get a submit value from a datefield with submitFormat specified. (datefield.getSubmitValue())
The result that was expected:
A valid time, timestamp, or millisecond representation of the date.
The result that occurs instead:
An invalid time, timestamp, or millisecond representation of the date.
Test Case:
Code:Ext.onReady(function(){ timeStampDateField = Ext.create('Ext.form.field.Date',{ fieldLabel:'\"timestamp\" formatter is broken', labelAlign:'right', renderTo:Ext.getBody(), labelWidth:150, margin:'0 0 10 0', submitFormat:'timestamp', listeners:{ change:function(me){ alert("timestamp: "+me.getSubmitValue()) } }, minValue:new Date() }); timeDateField = Ext.create('Ext.form.field.Date',{ fieldLabel:'and so is \"time\"', labelAlign:'right', renderTo:Ext.getBody(), labelWidth:150, margin:'0 0 10 0', submitFormat:'time', listeners:{ change:function(me){ alert("time: "+me.getSubmitValue()) } }, minValue:new Date() }); timeDateField = Ext.create('Ext.form.field.Date',{ fieldLabel:'and \"u\"', labelAlign:'right', renderTo:Ext.getBody(), labelWidth:150, margin:'0 0 10 0', submitFormat:'u', listeners:{ change:function(me){ alert("u: "+me.getSubmitValue()) } }, minValue:new Date() }); });
-
6 Sep 2012 1:02 PM #2
This isn't a bug. 'time' & 'timestamp' are not valid Date formats: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date
'u' is, which is why you get 000. You want 'U'.Decimal fraction of a secondEvan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
7 Sep 2012 5:21 AM #3
Oh - they used to work: (see http://docs.sencha.com/ext-js/4-1/#!...cfg-dateFormat)
I had thought those were just partially documented standards. Is there an option for milliseconds? Or do I need to multiply seconds by 1000 everywhere we use date objects?Last edited by rliota; 10 Sep 2012 at 7:01 AM. Reason: information added
-
11 Sep 2012 6:42 AM #4
Well because millisecond formatting is apparently gone, may I request some form of it gets put back in?
I even wrote the code for you guys:
http://www.sencha.com/forum/showthre...l=1#post885602
-
11 Sep 2012 1:22 PM #5
I suppose we could add it, but I don't recall "time" or "timestamp".
In fact I just checked in 3.x and 2.x, Ext.Date never had "time" or "timestamp" formatters, so perhaps you had some custom code that added them.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
12 Sep 2012 5:25 AM #6
Thanks for your reply!
Hmm - I was using them in my model. (not directly in a date picker - which was just the easiest way to demonstrate this.)
Is it possible the model's dateFormat configuration was using more than Ext.Date at one point? I know there are vestiges of the dateFormat config taking "time" and "timestamp" on the Ext.data.Field class according to the docs.
-
4 Oct 2012 11:46 PM #7
I can reproduce...
I can reproduce...
Hi!
I can reproduce the problem.
I set dateFormat in the model to "time", and the server send a millisecond.
It's work correctily, but if I want to save this field the date format generate: '313710e' string
I thin it's parse the text char-by-char...
t - days in month (oct have 31)
i - minutes with leading zero (37)
m - month with leading zero (10)
e - 'e' becuase it's not parsed...b0c1
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote