Bug 879537 - Be more strict when setting Date properties of contacts. r=gwagner

--HG--
extra : rebase_source : 61741dc83d4b1e4ca0a9bd7bae070fcb1aed63d1
This commit is contained in:
Reuben Morais 2013-06-12 13:48:20 -07:00
parent 3cf6d76d10
commit e440660878

View File

@ -417,7 +417,9 @@ Contact.prototype = {
},
set bday(aBday) {
if (aBday !== undefined && aBday !== null) {
if (aBday instanceof Date) {
this._bday = aBday;
} else if (typeof aBday === "string" || typeof aBday === "number") {
this._bday = new Date(aBday);
}
},
@ -427,7 +429,9 @@ Contact.prototype = {
},
set anniversary(aAnniversary) {
if (aAnniversary !== undefined && aAnniversary !== null) {
if (aAnniversary instanceof Date) {
this._anniversary = aAnniversary;
} else if (typeof aAnniversary === "string" || typeof aAnniversary === "number") {
this._anniversary = new Date(aAnniversary);
}
},