Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] parseInt glitch
- From: twenger at vltool.com (tyson)
- Subject: [Javascript] parseInt glitch
- Date: Tue Aug 16 16:51:41 2005
I'm using javascript to validate the syntax of a "date" input by the
user. I split the string variable by "/" and then check each month,
day, year... Anyways, I noticed that when I use the function
parseInt(month), I get an error if its higher than '07'. For example:
parseInt('01') = 1
parseInt('02') = 2
parseInt('07') = 7
but parseInt('08') = 0
and parseInt('09') = 0
This problem only occurs if there's a "0" in front of the number. If I
do parseInt('8') it works fine, but parseInt('08') doesn't. Does
anybody know why it does this? I don't want to mask out the "0" if I
don't have to, but that looks like the only option now. I tested this
on a command line, so I know its not just my program. Any help would
be appreciated!
-Tyson
- Follow-Ups:
- [Javascript] parseInt glitch
- From: Peter Brunone
- [Javascript] parseInt glitch
- Prev by Date: [Javascript] nevermind about last email
- Next by Date: [Javascript] parseInt glitch
- Previous by thread: [Javascript] nevermind about last email
- Next by thread: [Javascript] parseInt glitch
- Index(es):