Prev: trouble with string replace
Next: FAQ Topic - How do I change print settings for window.print()? (2010-02-23)
From: Dr J R Stockton on 22 Feb 2010 15:26 In comp.lang.javascript message <8256448.J7NaK4W3va(a)PointedEars.de>, Sat, 9 Jan 2010 19:08:42, Thomas 'PointedEars' Lahn <PointedEars(a)web.de> posted: >Dr J R Stockton wrote: > >> Be aware that setFullYear can be given three arguments. > >(per ES3F and ES5) > >This is very useful advice. Thank you. > >It lead me to find out (you probably know that already) that several Date >prototype setters support several arguments, too. In a nutshell: But surely you have read ECMA 263 3 & 5, and ISO/IEC 16262, from one end to the other ? Multi-argument setters are included in <URL:http://www.merlyn.demon.co.uk/js-dobj2.htm>, probably correctly. >15.9.5.30 Date.prototype.setSeconds (sec [, ms ] ) >15.9.5.31 Date.prototype.setUTCSeconds (sec [, ms ] ) >15.9.5.32 Date.prototype.setMinutes (min [, sec [, ms ] ] ) >15.9.5.33 Date.prototype.setUTCMinutes (min [, sec [, ms ] ] ) >15.9.5.34 Date.prototype.setHours (hour [, min [, sec [, ms ] ] ] ) >15.9.5.35 Date.prototype.setUTCHours (hour [, min [, sec [, ms ] ] ] ) >15.9.5.38 Date.prototype.setMonth (month [, date ] ) >15.9.5.39 Date.prototype.setUTCMonth (month [, date ] ) >15.9.5.40 Date.prototype.setFullYear (year [, month [, date ] ] ) >15.9.5.41 Date.prototype.setUTCFullYear (year [, month [, date ] ] ) > >But I wonder, are these implemented consistently? Surely you have already >done some research on the matter. For any methods and arguments given in ECMA 3, which was finished by late 1999 and presumably available in draft to browser-writers before them, one should expect implementation in all reputable "full" browsers in all vaguely current versions. I've frequently used (and probably posted here??) setFullYear with YMD and setHours with hms - and never noticed any problem; and I've never AFAIR seen any problem reported. However, Firefox 2.0.0.3-16 treated D < 1 as D = 1 in Date.UTC(Y,M,D) (Firefox 3 is OK) and in retrospect it would have been well to test the set routines above (and set[UTC]Date) with D = 0. -- (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05. Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc. |