Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2008-04-06 [geoffrey.mcgill] Revision #152 1. Added Date.prototype.getWeek(). Gets the week number. The first week of the year is the week which contains the first Thursday. Monday is considered the first day of the week. The .getWeek algorithm is a JavaScript port of the work presented by Claus Tøndering at http://www.tonderingdk/claus/cal/node8.html#SECTION00880000000000000000 .getWeek() Algorithm Copyright (c) Claus Tondering. The .getWeek() function does NOT convert the date to UTC. The local datetime is used. Please use .getISOWeek() to get the week of the UTC converted date. Returns a number from 1 to (52 or 53) depending on the year. Example Date.today().getWeek(); 3. Added Date.prototype.getISOWeek(). Get the ISO 8601 week number. Week one (1) is the week which contains the first Thursday of the year. Monday is considered the first day of the week. The .getISOWeek() function does convert the date to it's UTC value. Please use .getWeek() to get the week of the local date. 4. Added Date.prototype.setWeek(). Moves the date of the current instance to Monday of the week set. Accepts a number (1 to 53) that represents the week of the year to move to. Returns the date instance (this). Example Date.today().setWeek(1); // 1st week of year 5. Added a series of tests to /trunk/test/core/ to test for new .getWeek() and .setWeek() functions. 6. Removed non-plural config options from Date.prototype.add(). Example // Old Date.today().add({month: 1, day: 1, hours: 1}); // mixed pluralization was acceptable // New Date.today().add({months: 1, days: 1, hours: 1}); // Only plural config options now accepted. 7. Added 'week' as config option to .set(). Example Date.today().set({week: 26}); 8. Fixed bug where Date.parse("week 1") was not returning the correct date. 9. Removed final sugarpak.js dependency from within parser.js. Now the modules can be included in the following order, with the preceding module required by the next. 1. CultureInfo 2. core.js 3. parser.js 4. sugarpak.js 10. Removed .toJSONString() from sugarpak.js. Please use .toISOString(). The .toISOString() function will return an ISO 8601 string of the date that has been converted to it's UTC value. The following example demonstrates passing a format to the .toString() function to return a string whose date has NOT been converted to it's UTC value and does not include the wrapping double-quotes of .toISOString(). Example new Date().toString("yyyy-MM-ddTHH:mm:ssZ"); 11. Confirmed core.js and sugarpak.js modules still validate JSLint (http://www.jslint.com) 100% in whitespace strict mode. -------------------- git-svn-id: http://datejs.googlecode.com/svn/trunk@152 1386df6d-df38-0410-ade5-638ece4065a8
- Loading branch information