Possible Duplicate:
Workarounds for JavaScript parseInt octal bug
I've been working on a javascript function, setting date objects by declaring the year, month & date. However, when the month has a value of 08
or 09
, 0
is returned when using parseInt()
. See below:
parseInt("01") //returns 1
parseInt("02") //returns 2
parseInt("03") //returns 3
parseInt("04") //returns 4
parseInt("05") //returns 5
parseInt("06") //returns 6
parseInt("07") //returns 7
parseInt("08") //returns 0?
parseInt("09") //returns 0?
parseInt("10") //returns 10
I've created a jsFiddle to demonstrate this issue:
Why does parseInt("08")
and parseInt("09")
return 0
?