![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
A friend of mine has a problem with his credit card validation routine and it is probably a simple thing to solve but I cannot find it. It has to do with the expiry dates. What happens is that as each month passes, that month is then not recognised as being valid, even though the year makes it still valid. i.e. the number of the month entered has to be bigger than the number of the current month. Therefor, if it is in august now 09/2005 wil be valid but 08/2005 will be rejected. Below quoted is the code, could anybody make sense of this problem? Thanks! ... |
|
//now check that the date is valid i.e. greater or equal to now thisdate = new Date(); thisyear = thisdate.getYear() + 1900; thismonth = thisdate.getMonth(); if ((CCmonth <= thismonth) && (CCyear <= thisyear)) { alert("Your credit card has expired"); failed = true; ... How about only copying the code which does the date checking, all the rest |
![]() |
| Thread Tools | |
| Display Modes | |
| |