Skip to content
Ellegonzalez edited this page Nov 21, 2016 · 4 revisions

Formats the credit card expiry date in the mm / yyyy format:

  • Limits to 6 numbers
  • Restricts input to numbers
  • Includes a / between the month & year
$('input.credit_card_expiry').formance('format_credit_card_expiry');

Validates the credit card expiry date:

  • Validates numbers
  • Validates in the future
  • Supports year shorthand mm / yy
$('input.credit_card_expiry').formance('validate_credit_card_expiry');

//examples
$("<input value='05 / 20' />").formance('validate_credit_card_expiry');      // true
$("<input value='05 / 2020' />").formance('validate_credit_card_expiry');   // true
$("<input value='05 / 1900' />").formance('validate_credit_card_expiry');   // false
$("<input value='mm / 20' />").formance('validate_credit_card_expiry');    // false

Make sure to read about the credit card autocomplete recommendations & credit card debt settlement letter.