Opened 14 years ago
Closed 9 years ago
#6008 closed enhancement (wontfix)
[patch] [cla] function to parse any kind of date (string, object, etc)
Reported by: | wolfram | Owned by: | wolfram |
---|---|---|---|
Priority: | low | Milestone: | future |
Component: | Dojox | Version: | 1.0 |
Keywords: | needsreview | Cc: | Neil Roberts |
Blocked By: | Blocking: |
Description (last modified by )
I was missing a general functionality to detect any kind of date and properly convert it, so I wrote quite a simple first version of it. Interesting for dojo?
// Return a Date object for the various inputs dojo.date.get(new Date()); dojo.date.get("2009-11-11 11:12:13") dojo.date.get("now"); dojo.date.get("yesterday"); dojo.date.get("3 days ago"); dojo.date.get("3 weeks ago");
and I am sure that a lot of things could be interesting to be done, like "+3 days", "-1 week", etc. (next Tuesday, a week from tomorrow, etc)
The actual idea came from http://trac.dojotoolkit.org/browser/dojox/trunk/dtl/filter/dates.js?rev=12531#L9 where a date needs to be detected and converted, so i thought generalize it and make this patch.
Attachments (2)
Change History (16)
comment:1 Changed 14 years ago by
Type: | defect → enhancement |
---|
Changed 14 years ago by
Attachment: | date_get.patch added |
---|
comment:2 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:4 Changed 14 years ago by
Description: | modified (diff) |
---|
Changed 14 years ago by
Attachment: | dtl_dates.patch added |
---|
comment:5 Changed 14 years ago by
Cc: | Neil Roberts added |
---|
comment:6 Changed 14 years ago by
Component: | Date → Dojox |
---|
this isn't localized, so it can't go in dojo. Perhaps we could look into localization, but the nls stuff is hard to do right. The JSDate project has code to do this, though it didn't seem like it was precise where localization was concerned. A non-localized version like you have could go into dojox.strings or something, I suppose, though I don't personally endorse it... yet.
I'm not sure what's accomplished by the Date object input, and the ISO-like thing ought to be close enough to dojo.date.stamp that it's not necessary. With the ISO dates, wouldn't you usually be restricted to that type?
Possibly a dup of #1646
comment:7 Changed 14 years ago by
Milestone: | → 1.2 |
---|
comment:8 Changed 14 years ago by
Description: | modified (diff) |
---|---|
Owner: | changed from Adam Peller to wolfram |
Given the state of the patch, I'm not sure if this should be marked 1.2.
This is ok as long as it goes into dojox and is marked experimental and not localized (though it would be really interesting to see if a localized version of this could be accomplished -- some of the strings might even be available in dojo.cldr)
I'd suggest not using the Date() constructor to parse, since it's not specified and varies across browsers. Also, if you must compare the constructor value for validity, check with isNaN, not == "Invalid Date".
ISO stamps in dojo.date require "T". If you want, you can provide a dojox.date routine that just does a replace " " -> "T" then pass to dojo.date.stamp.
comment:9 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:10 Changed 14 years ago by
Milestone: | 1.2 → 1.3 |
---|
bump enhancements to next milestone, as we prepare to close out 1.2
comment:11 Changed 14 years ago by
Milestone: | 1.3 → future |
---|---|
Summary: | dojo.date.get() detect any kind of date (string, object, etc) → [patch] [cla] dojo.date.get() detect any kind of date (string, object, etc) |
comment:12 Changed 10 years ago by
Keywords: | needsreview added |
---|---|
Priority: | high → low |
i'm trying to identify stale tickets. if there is a need to keep this ticket open, please replace the "needsreview" keyword with "reviewed". if there is no need to keep this ticket open then please close it.
comment:13 Changed 10 years ago by
Summary: | [patch] [cla] dojo.date.get() detect any kind of date (string, object, etc) → [patch] [cla] function to parse any kind of date (string, object, etc) |
---|
comment:14 Changed 9 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I am afraid that additional components such as this won't be considered for DojoX at this point and in Dojo 2.0 they will need to be a community package.
Packages can be submitted at http://packages.dojofoundation.org/ or please view where we are headed for packages in Dojo 2.0: https://docs.google.com/a/kitsonkelly.com/document/d/17B7A0eGbBAYsuZTQCnMnQ-xNiuB5NVc4vKYJqp3a_CE/edit
This patch shows how i.e. the dojox.dtl.filter.dates would benefit from dojo.date.get()