cc-expiry
An NPM package for formatting credit card expiry dates in MM/YY or MM/YYYY formats.
Usage
Import the lib:
//With ES6-style imports; // With node-style requires:var format = format;
format(expiry: string, customSeparator?: string, fourDigitYear?: boolean)
console; // '12 / 34'console; // '12 / 34'console; // '12 / 34'console; // '12 / 34'console; // '12 / 34'console; // '12 / 3'console; // '12'console; // '1'
With a custom separator:
console; // '12🍎34'console; // '12🍎34'console; // '12🍎34'console; // '12🍎34'console; // '12🍎3'console; // '12'console; // '1'
With a 4-digit year (MM / YYYY)
console; // '12/3456'console; // '12/345'console; // '12/34'console; // '12/34'console; // '12/34'console; // '12/3'console; // '12'console; // '1'