Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5654 closed defect (invalid)

Issue with the method

Reported by: [email protected] Owned by: Adam Peller
Priority: high Milestone: 1.1
Component: Date Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Adam Peller)

when calling the I am getting a javascript error

The following is the sample code

 alert("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 14 years ago by Adam Peller

Cc: [email protected] removed
Description: modified (diff)
Milestone: 1.21.1
Reporter: changed from guest to [email protected]
Resolution: invalid
Status: newclosed

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.

comment:2 Changed 14 years ago by Adam Peller

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.