stripe-archive / jquery.payment

[DEPRECATED] A general purpose library for building credit card forms, validating inputs and formatting numbers.
MIT License
3.53k stars 686 forks source link

validateCardExpiry always returns false #253

Closed mikemand closed 8 years ago

mikemand commented 8 years ago

Expected behavior

$.payment.validateCardExpiry(expiry); should return true if a valid month and year (for example 10/20) are passed in the expiry object.

Actual behavior

Using var expiry = $('input.card-expiry').payment('cardExpiryVal'); to get the expiration value, $.payment.validateCardExpiry() always returns false no matter what format I pass the month and year. Likewise, any month and year combination I have tried fails. Here are some that I've tried:

$.payment.validateCardExpiry(expiry);
$.payment.validateCardExpiry(expiry.month, expiry.year);
$.payment.validateCardExpiry(expiry.month + '', expiry.year + '');
$.payment.validateCardExpiry("'" + expiry.month + "'", "'" + expiry.year + "'");
$.payment.validateCardExpiry(new String(expiry.month), new String(expiry.year));

I have tested on Chrome Version 53.0.2785.143 (64-bit) on OS X 10.11.6 so far.

Steps to reproduce

An example of the problem can be found here: http://jsfiddle.net/gosseti/x9vhpeL7/ (from the article here: http://gosseti.com/demos/a-better-card-payment-form). The Expires field should be outlined in green when putting in any valid expiration date, but it isn't.

shaun-stripe commented 8 years ago

Unable to reproduce.

I'm on Chome Version 54.0.2840.71 (64-bit) on OS X 10.11.6. This is what I see when inputting your example expiry in the jsfiddle. The field is highlighted in green:

screen shot 2016-10-25 at 11 58 08 am
duanewilson commented 8 years ago

FYI - Seems to also work fine in Safari Version 10.0.1 (12602.2.14.0.7) Mac OS X 10.12.1

screen shot 2016-10-25 at 10 04 23 am

mikemand commented 8 years ago

How odd. It appears to be working now. Thank you for working the voodoo and correcting the problem. 😄