Skip to content

Commit

Permalink
Workaround to mail not being sent if a contact has birthday only in G+
Browse files Browse the repository at this point in the history
Workaround for issue #48
  • Loading branch information
baatochan authored and GioBonvi committed Sep 1, 2017
1 parent aeeb622 commit 1090f89
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -743,15 +743,19 @@ var Contact = function (event, eventType) {
}

// Store information for each event (name and years passed).
dates.forEach(function (eachDate) {
var dateLabel = eachDate.getLabel();
doLog('Has ' + dateLabel + ' year.');
self.dateLabels.push(dateLabel);
startYear = eachDate.getYear();
if (startYear) {
self.age[dateLabel] = (currentYear - startYear).toFixed(0);
}
});
if(dates[0] !== undefined) { // When contact has birtday field only in G+ part dates variable is empty
dates.forEach(function (eachDate) {
var dateLabel = eachDate.getLabel();
doLog('Has ' + dateLabel + ' year.');
self.dateLabels.push(dateLabel);
startYear = eachDate.getYear();
if (startYear) {
self.age[dateLabel] = (currentYear - startYear).toFixed(0);
}
});
} else {
self.dateLabels.push(self.eventType);
}

// Extract contact's phone numbers.
phoneFields = googleContact.getPhones();
Expand Down

0 comments on commit 1090f89

Please sign in to comment.