Opened 16 years ago
Closed 16 years ago
#645 closed defect (wontfix)
Sortable Table does not handle date format correct
Reported by: | anonymous | Owned by: | Tom Trenka |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | Widgets | Version: | 0.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
In file D:downloadsAjaxdojotoolkit estswidget est_SortableTable.html
In line 103 I tried to use <th field="DateModified?" dataType="Date" format="%d.%m.%Y">Date Modified</th> in order to get the german date format. First everything works fine, but after sorting I got: NaN.NaN.NaN rows. The next thing I tried to use the Date format format="%d %m %Y". This means without the dots. But after sorting the entry with Id 23 has now value 4 11 2003 and not 23 04 2002
Browser was Firefox, System is Windows
Change History (4)
comment:1 Changed 16 years ago by
Milestone: | 0.3release → 0.4 |
---|
comment:2 Changed 16 years ago by
Owner: | changed from anonymous to Tom Trenka |
---|
Oops, also meant to assign to me.
comment:3 Changed 16 years ago by
Milestone: | 0.4 → 0.5 |
---|
Pushing out to 0.5; apparently i8ln date formatting is due for inclusion in 0.4, and I'd like the shake out of that code to happen before including it for release here.
comment:4 Changed 16 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Killing in favor of Filtering.
Looking in the code for SortableTable? regarding date sorting...I think probably your issue has less to do with the sortable table and more to do with the lack of full internationalization within Javascript. When parsing data for the table, the SortableTable? uses the default JS constructor for the date (using aliases for the constructor); if the date you passed in isn't parsable by the standard JS Date constructor (i.e. if you can't do this:
then you won't get a valid date object for sorting in the underlying data model, which is the main issue here.
I didn't code any special handling for i8n date parsing (trying to use the language defaults as much as possible) but I can see that there might be a definite issue with date comparison (although it should default to date.valueOf() for the comparator).
The formatter itself should work just fine; it's a simple call to dojo.date.format which was pretty well tested.
If you were to pass the widget dates in either the American format or (more preferably) using the UTC standard, you'll probably get the results you want.
I'm going to push this back to 0.4, when we're slated (in theory) to start talking about / dealing with i8n issues within Dojo.