Login Register

dojo.date changes

dojo.date has been refactored into newly named modules:

  • dojo.date.* - miscellaneous methods, such as leap year calculations and calculations based on dates, such as diff(), add(), and compare(). Now uses string arguments ('minutes', 'seconds'...) instead of enum style arguments like dojo.date.dateParts and .compareTypes
  • dojo.date.locale.* - for methods dependent on local customs, such as formatting and parsing of dates represented as strings using a particular locale, formerly dojo.date.format() and dojo.date.parse()
  • dojo.date.stamp.* - to serialize the date in a way which does not depend on local customs and is therefore suitable for storage or submission to a server, formerly dojo.date.to/fromRfc3339() and to/fromIso8601() methods
  • dojox.date.posix.* - includes support for the strftime() method

Code in dojo.date.supplemental can now be found at dojo.cldr.supplemental.

Methods which take a 'selector' argument (parse, format, regexp, fromRfc3339) now expect to see 'date' or 'time' to operate on the date or time portions respectively, instead of 'dateOnly' and 'timeOnly'. Now by default, both date and time will be considered.

Some function was eliminated from Dojo, including things which we were unable to easily localize, such as time zone arrays, dojo.date.getOrdinal, dojo.date.toRelativeString. Also removed were dojo.date.to/fromSql, and dojo.date.get*Name helper methods in favor of dojo.date.local.getNames()

Missing APIs???

I could not port these 2 date apis
1) dojo.date.format
2) dojo.date.dateParts

Could someone tell me what is the equivalent version in 0.9 ?

0.9 equivalents

dojo.date.format -> dojo.date.locale.format

and the "enum" style argument passing for dateParts and compareTypes are no longer used. Now, dojo.date.add just takes a string for the interval parameter, e.g. "year" or "month" or "day"... compare() takes "date" or "time". We did this to be more consistent with the rest of the Dojo APIs and also to save on code size.

-Adam