Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15063 closed defect (fixed)

no way to set Date programmatically for any of the mobile DatePicker widgets

Reported by: ben hockey Owned by: ykami
Priority: high Milestone: 1.8
Component: DojoX Mobile Version: 1.7.2
Keywords: Cc: Eric Durocher
Blocked By: Blocking:

Description

at http://download.dojotoolkit.org/release-1.7.2/dojo-release-1.7.2/dojox/mobile/tests/test_SpinWheelDatePicker.html i opened the console and tried to set the value via

dijit.byId('spin1').set('values', [2010, 9, 1])

i tried various other ways too without any success. if there is a way to set the date programmatically then consider this a documentation defect and it can be closed once the docs at http://livedocs.dojotoolkit.org/dojox/mobile/SpinWheelDatePicker have been updated

Change History (8)

comment:1 Changed 7 years ago by ben hockey

in addition, i was also not able to get the value set via the constructor. for example,

new dojox.mobile.SpinWheelDatePicker({values: [2010, 9, 1]}).placeAt(dojo.body())

comment:2 Changed 7 years ago by ykami

Milestone: tbd1.8
Priority: undecidedhigh
Status: newassigned

comment:3 Changed 7 years ago by ykami

Thanks for the report. The setter for the slots simply accept label strings. So ["2010", "Sep", "1"] should work. But apparently it is inconvenient because the labels are locale dependent. It should accept [2010, 9, 1] as well as you suggested.

comment:4 Changed 7 years ago by ykami

Resolution: fixed
Status: assignedclosed

In [28252]:

Fixes #15063 !strict. Fixed the setter for values to take a date in numbers in addition to strings.

comment:5 Changed 7 years ago by ykami

In [28255]:

Refs #15063 !strict. Moved _setValuesAttr that handles date from _PickerBase to _DatePickerMixin.

comment:6 Changed 7 years ago by Eric Durocher

Cc: Eric Durocher added

It seems that the 'new Date(arr)' constructor is not supported by all browsers (it throws on FF at least), this should be changed to 'new Date(arr[0], arr[1], arr[2])' I think.

comment:7 Changed 7 years ago by ykami

I noticed your last comment just now. You are correct. Thank you!

comment:8 Changed 7 years ago by ykami

In [28314]:

Refs #15063 !strict. Changed the 'new Date(arr)' constructor to 'new Date(arr[0], arr[1], arr[2])' because it is not supported at least by firefox. Thank you edurocher for finding this.

Note: See TracTickets for help on using tickets.