From: John G Harris on
On Tue, 6 Oct 2009 at 20:12:45, in comp.lang.javascript, Dr J R Stockton
wrote:
>In comp.lang.javascript message <8CrRvmIqh3yKFwUx(a)J.A830F0FF37FB96852AD0
>8924D9443D28E23ED5CD>, Tue, 6 Oct 2009 18:03:38, John G Harris
><john(a)nospam.demon.co.uk> posted:

<snip>
>>Strictly speaking, the Date Object is the object named Date : the
>>constructor you use when you do new Date().
>
>The term is good enough for ISO/IEC 16262 15.9, which (for example)
>includes "A Date object contains a number indicating a particular
>instant in time to within a millisecond.
<snip>

In any other OO language you would say that Date is the function object
and a Date instance is an object constructed by Date. 'instance' should
be used more often in javascript discussions.

In the standard, "Date object" means the function object in section 4.2
and an object constructed by Date in section 15.9. The term is
thoroughly ambiguous and should be avoided where clarity is desired.

John
--
John Harris
From: Thomas 'PointedEars' Lahn on
John G Harris wrote:

> Dr J R Stockton wrote:
>> John G Harris posted:
>>> Strictly speaking, the Date Object is the object named Date : the
>>> constructor you use when you do new Date().
>>
>> The term is good enough for ISO/IEC 16262 15.9, which (for example)
>> includes "A Date object contains a number indicating a particular
>> instant in time to within a millisecond.
> <snip>
>
> In any other OO language you would say that Date is the function object
> and a Date instance is an object constructed by Date.

It is also used in the ECMAScript Language Specification(s) on numerous
occasions.

> 'instance' should be used more often in javascript discussions.

My words exactly.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: Asen Bozhilov on
"FAQ server" wrote:

> function parseISO8601(dateStringInRange)

parseISO8601 and Date object in ECMA 3 works with dates from Gregorian
calendar. And they follows algorithm for leap year in Gregorian
calendar, where:

year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)

In Julian calendar leap year is every year who's:

year % 4 == 0

Gregorian calendar since from 24 February 1582.
<URL:http://en.wikipedia.org/wiki/Gregorian_calendar>

Because that, date likes this:

new Date(1300, 1, 29); // Mon Mar 01 1300 00:00:00 GMT+0200 (FLE
Standard Time)
new Date(1400, 1, 29); // Sat Mar 01 1400 00:00:00 GMT+0200 (FLE
Standard Time)
new Date(1500, 1, 29); // Thu Mar 01 1500 00:00:00 GMT+0200 (FLE
Standard Time)

For my that's dates is absolutely valid date. That's dates existed in
real life.

From: Garrett Smith on
John G Harris wrote:
> On Mon, 5 Oct 2009 at 19:43:47, in comp.lang.javascript, Dr J R Stockton
> wrote:
>> In comp.lang.javascript message <4ac928fb$0$289$14726298(a)news.sunsite.dk
>>> , Sun, 4 Oct 2009 23:00:03, FAQ server <javascript(a)dotinternet.be>
>> posted:
>>
>>> FAQ Topic - How can I create a Date from a String?
>> That makes no sense; should be "Date Object".
> <snip>
>
> Strictly speaking, the Date Object is the object named Date : the
> constructor you use when you do new Date().
>

And one of those is "a Date".

A Date *is* and Object. Adding "Object" is redundant.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Dr J R Stockton on
In comp.lang.javascript message <lghpc5dq02b5vs17m33dn6vlo85vjpq8rt(a)4ax.
com>, Wed, 7 Oct 2009 18:49:45, Hans-Georg Michna <hans-
georgNoEmailPlease(a)michna.com> posted:
>On Tue, 6 Oct 2009 20:12:45 +0100, Dr J R Stockton wrote:
>
>>The term is good enough for ISO/IEC 16262 15.9, which (for example)
>>includes "A Date object contains a number indicating a particular
>>instant in time to within a millisecond. The number may also
>>be NaN, indicating that the Date object does not represent a specific
>>instant of time.".
>
>While you're at it, I've seen scripts that compare two Date
>objects directly, but I could not find any clue in any
>specification that this should work.


To most people, I guess it's not obvious what D1 == D2 does; I believe
it compares the objects to see if they are the same object. One might
think it could compare the toString() results, but that would be
wasteful of effort. Just compare +D1 with +D2.

You could have read <URL:http://www.merlyn.demon.co.uk/js=-date0.htm#DC>
instead of asking.


>The quoted text above also mentions the contained milliseconds,
>but it does not say that the Date object behaves like a number.

I only quoted the part of the document relevant to previous discussion;
if you want to know more, you should read it.

>It does not say how you get at those milliseconds. Elsewhere it
>is specified that you can use .getTime() to get at them.

Or .valueOf() - and if you consider the whole document you will see that
a unary + operator should do it (it does, and unary - does, and D-0
works, as does multiplying or dividing by 1, or using Number(D) ).


AFAICS, a Date object is not required to store its value as an IEEE
Double; but it is required to behave as if that were the case (apart
from the speed of operations, which is unspecified). There might be
advantage in actually storing a 64-bit signed integer.

--
(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.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Prev: Computer Techs Wanted
Next: move div by drag etc.