(js) Fix exception in Card service

When calling init from $reset, the birthday attribute is already a Date
object. Avoid raising an exception on wrong data type.
This commit is contained in:
Francis Lachapelle
2017-12-15 16:36:15 -05:00
parent 3816d25a44
commit e590aec64f

View File

@@ -174,7 +174,7 @@
_this.refs[i] = new Card(o);
});
// Instanciate date object of birthday
if (this.birthday) {
if (this.birthday && angular.isString(this.birthday)) {
var dlp = Card.$Preferences.$mdDateLocaleProvider;
this.birthday = this.birthday.parseDate(dlp, '%Y-%m-%d');
this.$birthday = dlp.formatDate(this.birthday);