Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#821 closed defect (fixed)

dropdowndatepicker: change will not reflect in widget if input is in german format

Reported by: anonymous Owned by: Adam Peller
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: dropdowndatepicker Cc:
Blocked By: Blocking:

Description

When entering a date in the format "31.12.2006" (DD.MM.YYYY) the widget will not be updated. The only format accepted will be "2006/12/31" (YYYY/MM/DD). It would be great if the timeformat set will also be used when entering data in textfield.

Attachments (1)

dojo-test.zip (114.0 KB) - added by guest 13 years ago.
zip with a java implementation of dojo.date.parse

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 years ago by bill

Milestone: 0.3.10.4

comment:2 Changed 13 years ago by icoloma@…

Priority: normalhigh

Seems that tickets #721 and #1008 are related. The following patch (two lines of code) resolves the most urgent needs:

1.- When the form has already a value in a non-US format, the input field respects that. 2.- When the input field has invalid input (e.g. xxx) the input text field should show the unmodified value (currently it shows NaN/NaN/NaN)

I have added two testcases to the sample html page in the patch, one for i18n and another for invalid dates.

A complete solution to this ticket would require a method to parse dates. Current methods format but they do not parse, so manually entered dates cannot be communicated to the DatePicker? (should be done at onInputChange and fillInTemplate). There is a good candidate for this in datetime.js (dojo.validate.isValidDate), that parses a whole date with a given format and only returns true or false. With minor changes it could return the parsed date and solve this bug.

To check the bug that we are resolving, open the html page in the browser before and after applying the patch. Since this is a showstopper for any non-US users (me included!), I have upgraded the priority.

Index: D:/workspace/dojo/src/widget/DropdownDatePicker.js
===================================================================
--- D:/workspace/dojo/src/widget/DropdownDatePicker.js	(revision 4584)
+++ D:/workspace/dojo/src/widget/DropdownDatePicker.js	(working copy)
@@ -30,7 +30,7 @@
 			if(this.date){
 				dateProps["date"] = this.date;
 				dateProps["storedDate"] = dojo.widget.DatePicker.util.toRfcDate(this.date);
-				this.inputNode.value = dojo.date.format(this.date, this.dateFormat);
+				this.inputNode.value = args.date;
 			}
 			this.datePicker = dojo.widget.createWidget("DatePicker", dateProps, dpNode);
 			dojo.event.connect(this.datePicker, "onSetDate", this, "onSetDate");
Index: D:/workspace/dojo/tests/widget/test_DropdownDatePicker.html
===================================================================
--- D:/workspace/dojo/tests/widget/test_DropdownDatePicker.html	(revision 4584)
+++ D:/workspace/dojo/tests/widget/test_DropdownDatePicker.html	(working copy)
@@ -11,6 +11,10 @@
 	<div dojoType="dropdowndatepicker" date="06/26/2006" containerToggle="wipe"></div>
 End date:
 	<div dojoType="dropdowndatepicker" date="06/28/2006" containerToggle="wipe"></div>
+I18N date:
+	<div dojoType="dropdowndatepicker" date="13/07/2006" dateFormat="%d/%m/%Y" containerToggle="fade"></div>
+Wrong date:
+	<div dojoType="dropdowndatepicker" date="xxx" containerToggle="fade"></div>
 	<div dojoType="button">Submit</div>
 	<div><select><option>crap</option></select></div>
 </body>

Changed 13 years ago by guest

Attachment: dojo-test.zip added

zip with a java implementation of dojo.date.parse

comment:3 Changed 13 years ago by Lance Duivenbode (dojo@…

Started conversion of Java implementation to Javascript.

comment:4 Changed 13 years ago by dylan

Owner: changed from anonymous to dylan
Status: newassigned

comment:5 Changed 13 years ago by Adam Peller

Dylan - you can throw this at me if you want

comment:6 Changed 13 years ago by Adam Peller

there is code for this being developed in dojo.i18n.datetime

comment:7 Changed 13 years ago by dylan

Owner: changed from dylan to Adam Peller
Status: assignednew

comment:8 Changed 13 years ago by Adam Peller

will be covered by ticket 1008

comment:9 Changed 13 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [5637]) DropdownDatePicker? handling of locale-based formatting and parsing of dates (fixes #1008, fixes #821) Use locale-independent serialization for dddp in a form (fixes #721) Removed experimental from dojo.date.parse (fixes #835)

comment:10 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.