javascript bug?
Posted: Wed Mar 28, 2007 5:27 pm
I'm reworking my JS calendar and I think I may have come across a bug.
I am parsing an integer out of a string to get the selected day and month...for some reason 08 and 09 when parsed go to 0 whereas every other number I've tried works fine.
I whipped up this little sample so you can try it yourself. Am I grossly overlooking something?
that should work because it's not 08 or 09
but this
returns a 0 for the integer value???????
any ideas?
I am parsing an integer out of a string to get the selected day and month...for some reason 08 and 09 when parsed go to 0 whereas every other number I've tried works fine.
I whipped up this little sample so you can try it yourself. Am I grossly overlooking something?
Code: Select all
<script>
field = "07/09/2004";
curDate = field.split("/");
curMon = parseInt(curDate[0]);
curYear = parseInt(curDate[2]);
curDay = parseInt(curDate[1]);
alert(curDate[0]);
alert(curMon);
</script>but this
Code: Select all
<script>
field = "08/09/2004";
curDate = field.split("/");
curMon = parseInt(curDate[0]);
curYear = parseInt(curDate[2]);
curDay = parseInt(curDate[1]);
alert(curDate[0]);
alert(curMon);
</script>any ideas?