#5654 closed defect (invalid)
Issue with the dojo.date.locale.format method
Reported by: | Owned by: | Adam Peller | |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Date | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
when calling the dojo.date.locale.format I am getting a javascript error
The following is the sample code
alert(dojo.date.locale.format(dojo.byId("encDate").value, {selector:'date'}));
The encDate is a date text box. The following is the error that I see in the firebug console
dateObject.getMonth is not a function (no name)("M")dojo.js (line 76) formatPattern("1/8/08", Object dateFormat-medium=MMM d, yyyy, "M/d/yy")dojo.js (line 42) toString()dojo.js (line 20) (no name)("M/d/yy", 0)dojo.js (line 494) toString(["M/d/yy"], function(), undefined)dojo.js (line 20) _processPattern("M/d/yy", function(), function(), function())dojo.js (line 490) (no name)("1/8/08", Object selector=date)dojo.js (line 236) fetch(Object queryOptions=Object query=Object start=0)patControler.acti... (line 40) (no name)("")dojo.js (line 513) (no name)(mousedown clientX=0, clientY=0)dojo.js (line 496) toString()dojo.js (line 20) [Break on this error] undefined
Change History (2)
comment:1 Changed 13 years ago by
Cc: | [email protected]… removed |
---|---|
Description: | modified (diff) |
Milestone: | 1.2 → 1.1 |
Reporter: | changed from guest to [email protected]… |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 13 years ago by
ah, you did say it was a DateTextBox?. So "value" is already a formatted string, but using a 'short' formatLength (you can change this in your DateTextBox? constraints. If you want to take value and format it a different way, you could parse it and reformat it, but the best thing to do is query DateTextBox? for the value in the form of a Date object using dijit.byId("encDate").getValue(), then pass the result along to format(). Hope this helps.
Note: See
TracTickets for help on using
tickets.
Maryann, to understand the use case, I need to know what dojo.byId("encDate").value evaluates to. It should be a Javascript Date object, but I'm guessing it's actually a string. format() takes native Javascript objects and converts them to strings using local conventions; parse() does the opposite.