Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get next day date

0 views
Skip to first unread message

Peter May

unread,
Feb 24, 2009, 9:29:36 AM2/24/09
to
Hello.

I made a short function, which aims to provide the date of the next day.
I do not know why, but in my version with the date of 28.02.2009 on the
function returns the result to me on 0-11-2009. Where do I have wrong?

var gdate = "28-02-2009"; // example date
var dateelm = gdate.split('-');
var day = dateelm[0];
var month = dateelm[1];
var year = dateelm[2];
var testDate = new Date(year, month, (day+1));
var nextD = [testDate.getDay(), testDate.getMonth(),
testDate.getFullYear()];
return nextD.join("-"); // return date of next day

--
Peter

Stevo

unread,
Feb 24, 2009, 9:40:11 AM2/24/09
to

You're adding one to the day (on line 6) without taking into account
that it could exceed the number of days in that month. For example, if
day is 31, you'd be incrementing it to 32. Same deal with 28 in February
on a non leap year.

Henry

unread,
Feb 24, 2009, 9:49:50 AM2/24/09
to
On Feb 24, 2:29 pm, Peter May wrote:
> I made a short function, which aims to provide the date of the
> next day. I do not know why, but in my version with the date
> of 28.02.2009 on the function returns the result to me on
> 0-11-2009. Where do I have wrong?
>
> var gdate = "28-02-2009"; // example date
> var dateelm = gdate.split('-');
> var day = dateelm[0];

Your day is a string at this point.

> var month = dateelm[1];
> var year = dateelm[2];
> var testDate = new Date(year, month, (day+1));

<snip>

When either operand to the + operator is a string the operation
performed is concatenation (with any non-string operands type-
converted into strings. The effect of - (day+1) - is the same as the
effect of - ("28" + "1") -, which is the string "281". The Date
constructor probably type-converts this into a number that it uses as
the number of days specified, but the 281st day of March is some time
in November.

Warning: month numbers used in/with javascript Date objects are zero
based (January is zero).

Peter May

unread,
Feb 24, 2009, 9:51:51 AM2/24/09
to
Stevo pisze:

When writing functions guiding the documentation from
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date
and examples from Google. I thought that the date will know about it.
However, even tried by:

var gdate = "28-02-2009"; // example date
var dateelm = gdate.split('-');
var day = dateelm[0];
var month = dateelm[1];
var year = dateelm[2];

var testDate = new Date(year, month, day);
testDate.setDate(testDate.getDate()+1);


var nextD = [testDate.getDay(), testDate.getMonth(),
testDate.getFullYear()];
return nextD.join("-"); // return date of next day

As a result of getting 0-2-2009. Hm...

--
Peter

Henry

unread,
Feb 24, 2009, 10:13:17 AM2/24/09
to
On Feb 24, 2:51 pm, Peter May wrote:
<snip>

> var nextD = [testDate.getDay(), testDate.getMonth(),
<snip> ^^^^^^

getDate will work better there.


Peter May

unread,
Feb 24, 2009, 10:33:35 AM2/24/09
to
Henry pisze:

Argh... You right.

--
Peter

Peter May

unread,
Feb 24, 2009, 10:41:12 AM2/24/09
to
Henry pisze:

So, I have to convert string to integer using parseInt.

> Warning: month numbers used in/with javascript Date objects are zero
> based (January is zero).

I forgot. Now, the complete working functions is:

gdate = "28-02-2009";
var day = parseInt(gdate[0])+1;
var month = parseInt(gdate[1])-1;
var year = parseInt(gdate[2]);
var testDate = new Date(year, month, day);
// array of dd, mm, yyy
var nextDay = [
((testDate.getDate())<10 ? "0" : "")+(testDate.getDate()),
((testDate.getMonth())<10 ? "0" : "")+(testDate.getMonth()+1),
testDate.getFullYear()
];
return nextDay.join("-");

Thanks for advices.

--
Peter

Evertjan.

unread,
Feb 24, 2009, 10:40:10 AM2/24/09
to

try:

var gdate = "28-02-2009"; // example date
var dateelm = gdate.split('-');
var day = dateelm[0];

var month = dateelm[1];
var year = dateelm[2];

var nextDate = new Date(year, --month, ++day);


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Matthias Reuter

unread,
Feb 24, 2009, 10:56:19 AM2/24/09
to
> var nextD = [testDate.getDay(), testDate.getMonth(),

getDay() returns the day of the week (0 = sunday). Use getDate() instead.

Matt

Evertjan.

unread,
Feb 24, 2009, 11:11:54 AM2/24/09
to
Peter May wrote on 24 feb 2009 in comp.lang.javascript:

> var nextDay = [
> ((testDate.getDate())<10 ? "0" : "")+(testDate.getDate()),
> ((testDate.getMonth())<10 ? "0" : "")+(testDate.getMonth()+1),
> testDate.getFullYear()
> ];
> return nextDay.join("-");

Alternative:

var today = new Date();

var tomorrow = [
(today.getDate()+101).toString().substr(1),
(today.getMonth()+101).toString().substr(1),
today.getFullYear()
].join('-');

alert(tomorrow);

Henry

unread,
Feb 24, 2009, 11:14:49 AM2/24/09
to
On Feb 24, 3:41 pm, Peter May wrote:
> Henry pisze:

<snip>
>> When either operand to the + operator is a string the
>> operation performed is concatenation (with any non-string
>> operands type-converted into strings. The effect of -

>> (day+1) - is the same as the effect of - ("28" + "1") -,
>> which is the string "281". The Date constructor probably
>> type-converts this into a number that it uses as the number
>> of days specified, but the 281st day of March is some time
>> in November.
>
> So, I have to convert string to integer using parseInt.
<snip>;

> var day = parseInt(gdate[0])+1;
<snip>

Not like that. If you use - parseInt - it is an extremely good idea to
get into the habit of providing its second (optional) "radix"
argument. Without that - parseInt - is allowed to chose the base that
it will use in interpreting its input. Specifically, strings that
start with "0x" will be interpreted as hexadecimal and strings that
start with "0" (not followed by "x") MAY be interpreted as octal
numbers. This is particularly problematic if your number strings
originate from dates as leading zeros are then likely.

If you must use - parseInt - then the form:-

var day = parseInt(gdate[0], 10)+1;

- would be safer, but plain type-conversation of the string will
assume base 10 and disregard leading zeros so either of:-

var day = Number(gdate[0])+1;

- or:-

var day = (+gdate[0], 10)+1; // Applying the unary + operator
// to the string.

- will be effective (with the last being by far the quickest).

Garrett Smith

unread,
Feb 24, 2009, 12:42:59 PM2/24/09
to
Henry wrote:
> On Feb 24, 3:41 pm, Peter May wrote:
>> Henry pisze:


>

> var day = (+gdate[0], 10)+1; // Applying the unary + operator
> // to the string.
>

That SyntaxError appears to be the result of copy and paste.

> - will be effective (with the last being by far the quickest).

gdate[0] can be converted to a number (possibly NaN) with the unary +:-

var day = +gdate[0];

Garrett

--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >

Henry

unread,
Feb 24, 2009, 12:55:57 PM2/24/09
to
On Feb 24, 5:42 pm, Garrett Smith wrote:
> Henry wrote:
>> On Feb 24, 3:41 pm, Peter May wrote:
>>> Henry pisze:
>
>> var day = (+gdate[0], 10)+1; // Applying the unary + operator
>> // to the string.
>
> That SyntaxError appears to be the result of copy and paste.
<snip>

That is a copy-paste error, but not a syntax error (comma operator is
fine in context). It should have been:-

var day = (+gdate[0]) + 1;

Thomas 'PointedEars' Lahn

unread,
Feb 24, 2009, 5:35:58 PM2/24/09
to

Henry wrote/zu Deiner Priorität-Alpha-1-Nachricht von Sternzeit 02/24/2009
05:14 PM:

Yes.

> but plain type-conversation of the string will
> assume base 10 and disregard leading zeros

No, it won't.

var s = "0x12";

// yields 18
+s

// yields 18
Number(s)

Tested in Firefox/Iceweasel (JavaScript 1.8) on Debian GNU/Linux.

> so either of:-
>
> var day = Number(gdate[0])+1;
>
> - or:-
>
> var day = (+gdate[0], 10)+1; // Applying the unary + operator
> // to the string.
>
> - will be effective (with the last being by far the quickest).

The unary plus may be the quickest, but since it works like Number() and
thus considers the prefix, I don't think the last two suggestions are
prudent to follow here.


PointedEars

Dr J R Stockton

unread,
Feb 24, 2009, 4:15:19 PM2/24/09
to
In comp.lang.javascript message <go10p4$q8b$1...@nemesis.news.neostrada.pl>
, Tue, 24 Feb 2009 15:29:36, Peter May <pete...@poczta.fm> posted:


You need to make the indicated changes :

var gdate = "28-02-2009"; // example date
var dateelm = gdate.split('-');
var day = dateelm[0];
var month = dateelm[1];
var year = dateelm[2];

var testDate = new Date(year, month-1, +day+1);
// ^^^^^^^ ^^^^^^
var nextD = [testDate.getDate(), testDate.getMonth()+1, testDate.getFullYear()];
// ^^^^^^^ ^^


return nextD.join("-"); // return date of next day

Note that unary + converts a String to a Number. Using parseInt on a
decimal digit string is unnecessary.

You should also use nextD.join("-").replace(/\b(\d)\b/g, "0$1");
or don't bother with an array and use a Leading Zero function.

IMHO, one should not, unless forced by local convention, use the ISO 8601
date field separator "-" without also using the ISO 8601 date field
order YYYY MM DD.


You could use

var gdate = "28-02-2009"; // example date

var D = new Date(gdate.replace(/(..).(..).(....)/, "$3/$2/$1"))
D.setDate(D.getDate()+1)
D.toLocaleString()

replacing the last line ATSR.

DATE object is updated.

Read the sig below, slowly.

--
(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 moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Garrett Smith

unread,
Feb 24, 2009, 6:21:54 PM2/24/09
to

Thomas, can you explain why you are using hexadecimal numbers in a date
string?

I am unfamiliar with this practice.

> Tested in Firefox/Iceweasel (JavaScript 1.8) on Debian GNU/Linux.
>

Apparently, so is the Date constructor/function.

new Date("1/0xf/2009");

"invalid date".

But that isn't stopping PointedEars...

>> so either of:-
>>
>> var day = Number(gdate[0])+1;
>>
>> - or:-
>>
>> var day = (+gdate[0], 10)+1; // Applying the unary + operator
>> // to the string.
>>
>> - will be effective (with the last being by far the quickest).
>
> The unary plus may be the quickest, but since it works like Number() and
> thus considers the prefix, I don't think the last two suggestions are
> prudent to follow here.
>

Backing up to the first post, I see that gdate[0] would have a good
chance of being "08" or "09". If that could be interpreted as octal,
that would result in an error two days out of the month and 2 months out
of the year ("08" and "09").

The relevant section is 9.3.1, "ToNumber Applied to the String Type"

| StrNumericLiteral :::
| StrDecimalLiteral
| HexIntegerLiteral

Further down:

| DecimalDigit ::: one of
| 0 1 2 3 4 5 6 7 8 9

It is unsafe to use unary + whenever hexadecimal date strings are used.
But what do I know. I still use decimal for date strings.

Evertjan.

unread,
Feb 25, 2009, 3:33:02 AM2/25/09
to
Dr J R Stockton wrote on 24 feb 2009 in comp.lang.javascript:

> var testDate = new Date(year, month-1, +day+1);

var testDate = new Date(year, --month, ++day);

> You should also use nextD.join("-").replace(/\b(\d)\b/g, "0$1");
> or don't bother with an array and use a Leading Zero function.

.replace(/\b(\d)\b/g, "0$1")

Nice, John.

> IMHO, one should not, unless forced by local convention, use the ISO 8601
> date field separator "-" without also using the ISO 8601 date field
> order YYYY MM DD.

"forced by local convention" indeed,
this is the most common notation overhere.

Jorge

unread,
Feb 25, 2009, 4:29:41 AM2/25/09
to
On Feb 24, 11:35 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> > but plain type-conversation of the string will
> > assume base 10 and disregard leading zeros
>
> No, it won't.
>
>   var s = "0x12";
>
>   // yields 18
>   +s

Oops, that's half-broken, isn't it ?

See:

javascript:s= "0x12";alert((+s)+ ","+ parseInt(s,16)); //-> 18,18

but:

javascript:s= "-0x12";alert((+s)+ ","+ parseInt(s,16)); //-> NaN,-18

--
Jorge.

Jorge

unread,
Feb 25, 2009, 5:27:22 AM2/25/09
to
On Feb 25, 10:29 am, Jorge <jo...@jorgechamorro.com> wrote:
>
> Oops, that's half-broken...

...in Safari: bug# 24156.

--
Jorge.

Peter May

unread,
Feb 25, 2009, 8:10:42 AM2/25/09
to
Dr J R Stockton pisze:

Thank You very much for suggestions.

> Read the sig below, slowly.

Why slowly? I see there what you want.

--
Peter

Peter May

unread,
Feb 25, 2009, 8:27:27 AM2/25/09
to
Dr J R Stockton pisze:
[...]

> You could use
>
> var gdate = "28-02-2009"; // example date
> var D = new Date(gdate.replace(/(..).(..).(....)/, "$3/$2/$1"))
> D.setDate(D.getDate()+1)
> D.toLocaleString()
>
> replacing the last line ATSR.
>
> DATE object is updated.

It is still a small problem. The function can accept parameters of the
date of 1-3-2009, but also 01-3-2009, 1-03-2009, and the "replace" does
not take into account.

--
Peter

Peter May

unread,
Feb 25, 2009, 9:59:27 AM2/25/09
to
Peter May pisze:

I was changed:


var D = new Date(gdate.replace(/(..).(..).(....)/, "$3/$2/$1"))

to:
var D = new Date(gdate.replace(/(\d{1,2}).(\d{1,2}).(\d{1,4})/,
"$3/$2/$1"));

to works with all cases above described.

--
Peter

Matthias Reuter

unread,
Feb 25, 2009, 10:33:32 AM2/25/09
to

var d = new Date(gdate.replace(/(\d{1,2}).(\d{1,2}).(\d{4})/, "$3/$2/$1"));

That'll accept one or two digits as date and month.

And since D is not a constructor I replaced it by d :-)

Matt

Dr J R Stockton

unread,
Feb 25, 2009, 9:22:31 AM2/25/09
to
In comp.lang.javascript message <49A4764E...@PointedEars.de>, Tue,
24 Feb 2009 23:35:58, Thomas 'PointedEars' Lahn <Point...@web.de>
posted:

>Henry wrote/zu Deiner Priorität-Alpha-1-Nachricht von Sternzeit 02/24/2009
>05:14 PM:
>> On Feb 24, 3:41 pm, Peter May wrote:


>> but plain type-conversation of the string will
>> assume base 10 and disregard leading zeros
>
>No, it won't.

Henry is referring to the OP's data and not to strings in general. The
OP has not validated his input as looking like a date, and so can be
considered to be sufficiently confident that it is ##-##-####. The OP's
data contains no letters, therefore the string cannot look like Hex.

> var s = "0x12";
>
> // yields 18
> +s
>
> // yields 18

Unary + does not ever consider a following string to be in octal.


>> var day = Number(gdate[0])+1;
>>
>> - or:-
>>
>> var day = (+gdate[0], 10)+1; // Applying the unary + operator
>> // to the string.

One wonders what that 10 might be intended for. It works well for the
eleventh day of each month, but not otherwise.

>> - will be effective (with the last being by far the quickest).
>
>The unary plus may be the quickest, but since it works like Number() and
>thus considers the prefix, I don't think the last two suggestions are
>prudent to follow here.

Unary + **SHOULD** consider "0x12" to be eighteen; it would be foolish
to return zero or seven hundred and thirty-two, and probably unwise to
return NaN. if those effects are wanted, they can be obtained by other
means.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF3 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

Thomas 'PointedEars' Lahn

unread,
Feb 25, 2009, 3:53:08 PM2/25/09
to
Dr J R Stockton wrote:
> Thomas 'PointedEars' Lahn posted:

>> Henry wrote:
>>> On Feb 24, 3:41 pm, Peter May wrote:
>>> but plain type-conversation of the string will
>>> assume base 10 and disregard leading zeros
>> No, it won't.
>
> Henry is referring to the OP's data and not to strings in general.

I don't think so, having read his response in context:

>>> [...] Specifically, strings that


>>> start with "0x" will be interpreted as hexadecimal and strings that
>>> start with "0" (not followed by "x") MAY be interpreted as octal
>>> numbers. This is particularly problematic if your number strings
>>> originate from dates as leading zeros are then likely.
>>>
>>> If you must use - parseInt - then the form:-
>>>
>>> var day = parseInt(gdate[0], 10)+1;
>>>

>>> - would be safer, but plain type-conversation of the string will
>>> assume base 10 and disregard leading zeros so either of:-


>>>
>>> var day = Number(gdate[0])+1;
>>>
>>> - or:-
>>>
>>> var day = (+gdate[0], 10)+1; // Applying the unary + operator
>>> // to the string.
>>>

>>> - will be effective (with the last being by far the quickest).


PointedEars

Dr J R Stockton

unread,
Feb 25, 2009, 2:58:08 PM2/25/09
to
In comp.lang.javascript message <go3hgh$hiq$1...@nemesis.news.neostrada.pl>
, Wed, 25 Feb 2009 14:27:27, Peter May <pete...@poczta.fm> posted:


The original article gave a date with a leading zero, so I showed code
for that case. Consider these.

D = new Date(gdate.replace(/(\d+).(\d+).(\d+)/, "$3/$2/$1"))
D = new Date(gdate.replace(/(.+)\D(.+)\D/, "$2/$1/"))
D = new Date(gdate.replace(/\D+/g, "/")) // needs Y-M-D

One of the things that the FAQ does not yet, AFAIR, say is that
undertaking string manipulation without considering RegExps is STUPID.
It takes very little time to learn enough for simple things as above.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

Dr J R Stockton

unread,
Feb 25, 2009, 2:58:15 PM2/25/09
to
In comp.lang.javascript message <go1vdv$cbo$1...@news.motzarella.org>, Tue,
24 Feb 2009 15:21:54, Garrett Smith <dhtmlk...@gmail.com> posted:

>It is unsafe to use unary + whenever hexadecimal date strings are used.
>But what do I know. I still use decimal for date strings.

Unary + works perfectly well with positive hexadecimal strings; it
treats them as hexadecimal. In better browsers, it also works with
negative ones.

That might be worth a FAQ mention.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

Dr J R Stockton

unread,
Feb 25, 2009, 3:20:25 PM2/25/09
to
In comp.lang.javascript message <Xns9BBD6126...@194.109.133.242>
, Wed, 25 Feb 2009 08:33:02, Evertjan. <exjxw.ha...@interxnl.net>
posted:

>
>> IMHO, one should not, unless forced by local convention, use the ISO 8601
>> date field separator "-" without also using the ISO 8601 date field
>> order YYYY MM DD.
>
>"forced by local convention" indeed,
>this is the most common notation overhere.

In the textarea at the bottom of
<URL:http://www.merlyn.demon.co.uk/js-date8.htm>,
put D = new DATE(Str) where string Str contains a Dutch numeric
date, and see what happens when the button is pressed. Then try D =
new DATE("~"+Str) .

I'm still wondering about reading a date string with a year less than
100; hoping for an elegant fix. Reading a valid ISO 8601 Ordinal Date
is wonderfully easy with new Date and a simple RegExp.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.


Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>

New : 32-bit COLS, LONGCALC, CHEKLINX in new directory.

Jorge

unread,
Feb 25, 2009, 6:53:42 PM2/25/09
to
On Feb 25, 8:58 pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:
>... In better browsers, it also works with negative ones.
>_______^^^^^^___________________________________________.

LOL, in the best it doesn't !
________^^^^^^^^_____________
--
Jorge.

Peter May

unread,
Feb 26, 2009, 3:28:36 AM2/26/09
to
Dr J R Stockton pisze:
> In comp.lang.javascript message <go3hgh$hiq$1...@nemesis.news.neostrada.pl>
> , Wed, 25 Feb 2009 14:27:27, Peter May <pete...@poczta.fm> posted:
>> Dr J R Stockton pisze:
>> [...]
>>> You could use
>>> var gdate = "28-02-2009"; // example date
>>> var D = new Date(gdate.replace(/(..).(..).(....)/, "$3/$2/$1"))
>>> D.setDate(D.getDate()+1)
>>> D.toLocaleString()
>>> replacing the last line ATSR.
>>> DATE object is
>>> updated.
>> It is still a small problem. The function can accept parameters of the
>> date of 1-3-2009, but also 01-3-2009, 1-03-2009, and the "replace" does
>> not take into account.
>
>
> The original article gave a date with a leading zero, so I showed code
> for that case. Consider these.

True. I noticed the error only in the later tests.

> D = new Date(gdate.replace(/(\d+).(\d+).(\d+)/, "$3/$2/$1"))
> D = new Date(gdate.replace(/(.+)\D(.+)\D/, "$2/$1/"))
> D = new Date(gdate.replace(/\D+/g, "/")) // needs Y-M-D
>
> One of the things that the FAQ does not yet, AFAIR, say is that
> undertaking string manipulation without considering RegExps is STUPID.
> It takes very little time to learn enough for simple things as above.

Have created exactly the same as provided in the "point" 1.

--
Peter

Jorge

unread,
Feb 26, 2009, 3:37:09 AM2/26/09
to
On Feb 25, 8:58 pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:
> In comp.lang.javascript message <go1vdv$cb...@news.motzarella.org>, Tue,
> 24 Feb 2009 15:21:54, Garrett Smith <dhtmlkitc...@gmail.com> posted:

>
> >It is unsafe to use unary + whenever hexadecimal date strings are used.
> >But what do I know. I still use decimal for date strings.
>
> Unary + works perfectly well with positive hexadecimal strings; it
> treats them as hexadecimal.  In better browsers, it also works with
> negative ones.

IOW, in Opera, FF and Chrome negative hexadecimals are handled fine.
Not so in Safari, nevertheless, as "it also works with negative ones"
isn't in the ECMA spec... (!), it isn't a bug.

Mira, mira:

https://bugs.webkit.org/show_bug.cgi?id=24156
--
Jorge.

Henry

unread,
Feb 26, 2009, 5:58:11 AM2/26/09
to
On Feb 25, 8:53 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> Dr J R Stockton wrote:
>> Thomas 'PointedEars' Lahn posted:
>>> Henry wrote:
>>>> On Feb 24, 3:41 pm, Peter May wrote:
>>>> but plain type-conversation of the string will
>>>> assume base 10 and disregard leading zeros
>>> No, it won't.
>
> > Henry is referring to the OP's data and not to strings in general.
>
> I don't think so, having read his response in context:

Not even with "This is particularly problematic if your number strings
originate from dates as leading zeros are then likely" preceding
descriptions of what could be done to address the problem?

Dr J R Stockton

unread,
Feb 26, 2009, 2:36:40 PM2/26/09
to
In comp.lang.javascript message <go5kc7$ios$1...@nemesis.news.neostrada.pl>
, Thu, 26 Feb 2009 09:28:36, Peter May <pete...@poczta.fm> posted:

Of course; it is the set of acceptable inputs which is changed.

DATE is doing well, in js-date8.

--

0 new messages