Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

payments-format="expiry" Invalid Date issue #93

Open
kevinwritescode opened this issue Jan 27, 2016 · 3 comments
Open

payments-format="expiry" Invalid Date issue #93

kevinwritescode opened this issue Jan 27, 2016 · 3 comments

Comments

@kevinwritescode
Copy link

I'm noticing when I first load a form with payments-format="expiry" that I'm getting an "Invalid Date" javascript error. I tracked it down to the function call for _getFormattedExpiry.

var _getFormattedExpiry = function(value) { if(value !== null) { var obj = Common.parseExpiry(value); var expiry = new Date(obj.year, obj.month-1); return $filter('date')(expiry, 'MM / yyyy'); } return null; };

The problem is that value being passed in is undefined, not null. I was able to fix the issue in my code by setting the ng-model value to null once I start the controller, but I wasn't sure if it'd be safer to check if null or undefined?

@piotrd
Copy link

piotrd commented Jan 28, 2016

This error appeared for me when I last time did a major update to packages in our project. Not sure which package had influence on revealing it, though.

I came up with the same workaround to this issue (initialising my model with null) and it works fine.

@mr-White
Copy link

mr-White commented May 9, 2016

Init scope.expiry or whatever the ngModel is for the expiration field to null fixes validation issue.

Thank you for the share

@abdou-ghonim
Copy link

abdou-ghonim commented Feb 4, 2020

same happen to me, setting ngModel to null fix the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants