19 lines
401 B
JavaScript
19 lines
401 B
JavaScript
'use strict';
|
|
|
|
const moment = require('moment');
|
|
|
|
/***
|
|
* Check whether a card month, year have expired
|
|
* @param month 1-12 month
|
|
* @param year the min 4-digit year
|
|
* @returns boolean true or false
|
|
*/
|
|
function isExpired(month, year) {
|
|
const theMoment = moment.utc([year, month - 1]);
|
|
return theMoment.isValid() && moment.utc() > theMoment.add(1, "months");
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
isExpired
|
|
} |