Opened 10 years ago

Closed 10 years ago

#9873 closed defect (invalid)

dojo.date not formatting dijit._Calendar value correctly

Reported by: steven3311 Owned by: anonymous
Priority: high Milestone: tbd
Component: General Version: 1.3.2
Keywords: Calendar, dijit._Calendar, dojo.date, date, format Cc:
Blocked By: Blocking:

Description

When you get the value from a dijit._Calendar and attempt to reformat it via "dojo.date.locale.format" the result is missing the month value. Here is an example:

//calendar object
var dateVal = dijit.byId("cal_"+this.id).attr("value"); 
var newDate =dojo.date.locale.format(new Date(dateVal), {selector:'date',datePattern:"mm/dd/yyyy"});
//newDate is equals 00/11/2009

Change History (2)

comment:1 in reply to:  description Changed 10 years ago by steven3311

Fixed my problem by removing the "datePattern" option.

updated code:

var dateVal = dijit.byId("cal_"+this.id).attr("value");
var newDate =dojo.date.locale.format(dateVal, {selector:'date',fullYear:true});

You can close this ticket. Thanks

comment:2 Changed 10 years ago by Adam Peller

Resolution: invalid
Status: newclosed

look closely at the spec referenced by the inline docs. The format string uses Java conventions,and I think month is a capital "M". I think lowercase "m" is minutes.

Note: See TracTickets for help on using tickets.