Opened 11 years ago

Last modified 6 years ago

#6008 closed enhancement

dojo.date.get() detect any kind of date (string, object, etc) — at Version 4

Reported by: wolfram Owned by: Adam Peller
Priority: low Milestone: future
Component: Dojox Version: 1.0
Keywords: needsreview Cc: Neil Roberts
Blocked By: Blocking:

Description (last modified by wolfram)

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.

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.

Change History (6)

comment:1 Changed 11 years ago by wolfram

Type: defectenhancement

Changed 11 years ago by wolfram

Attachment: date_get.patch added

comment:2 Changed 11 years ago by wolfram

Description: modified (diff)

comment:3 Changed 11 years ago by wolfram

Description: modified (diff)

comment:4 Changed 11 years ago by wolfram

Description: modified (diff)

Changed 11 years ago by wolfram

Attachment: dtl_dates.patch added

This patch shows how i.e. the dojox.dtl.filter.dates would benefit from dojo.date.get()

Note: See TracTickets for help on using tickets.