Search code examples
angularnpm-package

ng-payment-card : expiration year's dropdown doesn't contain proper options


I'm using ng-payment-card in my project and I had a serious issue in the expiration year's dropdown list, because the options contain only this year + a few years later only. anyone found a solution for this problem??

ng-payment-card package


Solution

  • The years appear to be generated here:

    public static getYears(): Array<number> {
        const years: Array<number> = [];
        const year = new Date().getFullYear();
        for (let i = -2; i < 5; i++) {
          years.push(year + i);
        }
        return years;
      }
    }
    

    As you can see, that -2 is hardcoded. I think the best you can do is alter your local copy of the source; although that's probably inadvisable.