Ticket #821 (closed defect: fixed)

Opened 2 years ago

Last modified 14 months ago

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

Reported by: anonymous Owned by: peller
Priority: high Milestone:
Component: Widgets Version: 0.3
Severity: normal Keywords: dropdowndatepicker
Cc:

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

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

Change History

Changed 2 years ago by bill

  • milestone changed from 0.3.1 to 0.4

Changed 2 years ago by icoloma@…

  • priority changed from normal to high

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 2 years ago by guest

zip with a java implementation of dojo.date.parse

Changed 2 years ago by Lance Duivenbode (dojo@…

Started conversion of Java implementation to Javascript.

Changed 2 years ago by dylan

  • owner changed from anonymous to dylan
  • status changed from new to assigned

Changed 2 years ago by peller

Dylan - you can throw this at me if you want

Changed 2 years ago by peller

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

Changed 2 years ago by dylan

  • owner changed from dylan to peller
  • status changed from assigned to new

Changed 23 months ago by peller

will be covered by ticket 1008

Changed 23 months ago by peller

  • status changed from new to closed
  • resolution set to fixed

(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)

Changed 14 months ago by anonymous

  • milestone deleted

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.