src/expiry_date_formatter.js
function interpretTwoDigitYear(year) {
  const thisYear = new Date().getFullYear();
  const thisCentury = thisYear - (thisYear % 100);
  const centuries = [thisCentury, thisCentury - 100, thisCentury + 100].sort(function(a, b) {
    return Math.abs(thisYear - (year + a)) - Math.abs(thisYear - (year + b));
  });
  return year + centuries[0];
}
function interpretTwoDigitYear(year) {
  const thisYear = new Date().getFullYear();
  const thisCentury = thisYear - (thisYear % 100);
  const centuries = [thisCentury, thisCentury - 100, thisCentury + 100].sort(function(a, b) {
    return Math.abs(thisYear - (year + a)) - Math.abs(thisYear - (year + b));
  });
  return year + centuries[0];
}
function interpretTwoDigitYear ( year ) { const thisYear = new Date ( ) . getFullYear ( ) ; const thisCentury = thisYear - ( thisYear % 100 ) ; const centuries = [ thisCentury , thisCentury - 100 , thisCentury + 100 ] . sort ( function ( a , b ) { return Math . abs ( thisYear - ( year + a ) ) - Math . abs ( thisYear - ( year + b ) ) ; } ) ; return year + centuries [ 0 ] ; }
Give this function a 2 digit year it'll return with 4.

@example
interpretTwoDigitYear(15);
// => 2015
interpretTwoDigitYear(97);
// => 1997
@param {number} year
@returns {number}
@private
Give this function a 2 digit year it ll return with 4 .