Message from discussion
silly question on Date value evaluation or comparison
Received: by 10.66.89.162 with SMTP id bp2mr351280pab.4.1349248355353;
Wed, 03 Oct 2012 00:12:35 -0700 (PDT)
Received: by 10.68.233.130 with SMTP id tw2mr1005733pbc.12.1349248355335; Wed,
03 Oct 2012 00:12:35 -0700 (PDT)
Path: t10ni23606524pbh.0!nntp.google.com!kt20no7640836pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.lang.javascript
Date: Wed, 3 Oct 2012 00:12:35 -0700 (PDT)
In-Reply-To: <+LUQ77IMbLZQFwll@invalid.uk.co.demon.merlyn.invalid>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=165.228.143.194;
posting-account=6cUlVQoAAABDk3JtwhqUs005Xjt2C0dN
NNTP-Posting-Host: 165.228.143.194
References: <f3ac39d0-7800-442d-ac95-f000b89e32b0@a11g2000yqb.googlegroups.com>
<k3tim5$hl1$1@speranza.aioe.org> <46cb7029-4d6f-421a-a2f2-7d3d18de660b@e14g2000yqm.googlegroups.com>
<k3u1v3$kq2$1@dont-email.me> <+LUQ77IMbLZQFwll@invalid.uk.co.demon.merlyn.invalid>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dea8cd7c-f0b0-4fb9-ad55-22e749e17e31@googlegroups.com>
Subject: Re: silly question on Date value evaluation or comparison
From: RobG <rg...@iinet.net.au>
Injection-Date: Wed, 03 Oct 2012 07:12:35 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Friday, 28 September 2012 06:27:56 UTC+10, Dr J R Stockton wrote:
[...]
> NEVER use new Date() except for the measurement of intervals of time.
Things like:
var d =3D new Date(2012,9,3)=20
are entirely consistent in every browser, I see no need to use any other me=
thod to create a date object.
>=20
> Use instead new Date(0), which gives consistent results and ought to be
> faster.
If the requirement is to create a date object for 1970-01-01T00:00:00Z, the=
n you might be correct (even ignoring the obvious "faster than what?"). But=
that is likely an infrequent scenario.
Usually a date object is required to be set to a specific value other than =
the epoch, so what is the benefit to creating the object then setting its v=
alue (requireing at least one and maybe two further calls) over creating th=
e object and setting its value in one call?
--=20
Rob