PDA

View Full Version : day of year



yogurtearl
29 Jun 2007, 6:52 AM
the documentation (http://extjs.com/deploy/ext-1.1-beta2/docs/output/Date.html#getDayOfYear) for Date.getDayOfYear says:
"returns: 0 through 365 (366 in leap years)"

That is one too many days. It should say "returns: 0 through 364 (365 in leap years)"

Although PHP starts numbering days of the years at 0, this is not standard.
ISO 8601 says that ordinal dates (http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates)should start with 1.
Java's DAY_OF_YEAR (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#DAY_OF_YEAR) also start with 1.
The unix date command (http://unixhelp.ed.ac.uk/CGI/man-cgi?date) (%j) starts at one also.

Any chance of getting Date.getDayOfYear to conform to the standard?

mystix
29 Jun 2007, 9:26 AM
the documentation (http://extjs.com/deploy/ext-1.1-beta2/docs/output/Date.html#getDayOfYear) for Date.getDayOfYear says:
"returns: 0 through 365 (366 in leap years)"

That is one too many days. It should say "returns: 0 through 364 (365 in leap years)"First up, thanks for spotting the bug. In future, pls report all Ext 1.1-beta2 bugs in this thread (http://extjs.com/forum/showthread.php?t=8492) instead.


Although PHP starts numbering days of the years at 0, this is not standard.
ISO 8601 says that ordinal dates (http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates)should start with 1.
Java's DAY_OF_YEAR (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#DAY_OF_YEAR) also start with 1.
The unix date command (http://unixhelp.ed.ac.uk/CGI/man-cgi?date) (%j) starts at one also.

Any chance of getting Date.getDayOfYear to conform to the standard?you might want to put up a feature request for this... the date parsing & formatting functions are modelled after PHP's Date function after all...


from the docs
The date parsing and format syntax is a subset of PHP's date() function, and the formats that are supported will provide results equivalent to their PHP versions.

[edit]
documentation bug has been fixed in SVN.