Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19010
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Accessing Constructor Arguments |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <a75c7d49-b129-4d92-a7a1-2bce31b71ce4@googlegroups.com> |
| Date | 2013-03-26 23:59 +0100 |
| Message-ID | <XnsA18FF4162252Eeejj99@194.109.133.133> (permalink) |
wrote on 26 mrt 2013 in comp.lang.javascript: > Interestingly, when a new instance of Date is created, if the date > supplied via the arguments is not a valid date, the date is > automatically adjusted to its nearest valid neighbor. You ony have to check the validity of two[!] of the three parts of the resulting date, something like: var tempA = myDateString.split(/[-.\/]/); // d-m-yyyy expected // [test for the array size being 3, and the components being numeric] var tempD = new Date(tempA[2],tempA[1]-1,tempA[0]); if (tempA[1]-1 != tempD.getMonth()) ... error if (tempA[2] != tempD.getFullYear()) ... error // now tempD.getDate() must be correct by logic. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Accessing Constructor Arguments ddjolley@gmail.com - 2013-03-26 09:59 -0700
Re: Accessing Constructor Arguments Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-26 18:32 +0100
Re: Accessing Constructor Arguments JJ <jaejunks@nah.meh> - 2013-03-27 05:53 +0700
Re: Accessing Constructor Arguments "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-26 23:59 +0100
Re: Accessing Constructor Arguments Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-03-27 20:56 +0000
csiph-web