I'm nearly finished with the script to automate the bulletin for my school. The last piece is to add the birthdays to the end of the bulletin. The user will have already entered a date for the bulletin, resulting in most of the bulletin being written. I want to use the entered date to compare against student birthdays in a sheet called Birthdays. I attempted to translate each birthday to the integer value of the day of the year based on this answer.
It is supposed to check the day, even though the year may be different and add the student's name to the next line.
Here is the code for this part so far:
var bDayHeader= "Birthdays"
bulletin.getRange(nextBullRow,1).setValue(bDayHeader);
nextBullRow+=2;
var birthdays = ss.getSheetByName("Birthdays");
var lastBdayRow = birthdays.getLastRow();
for(var i=2; i<=lastBdayRow; i++) {
var bRow = birthdays.getRange(i,1,1,3).getValues();
var bDay = new Date(bRow[0][0]);
var bDayStudent = bRow[0][2];
if(compareDate.getMonth() == bDay.getMonth() && compareDate.getDate() == bDay.getDate()){
Logger.log(bDayStudent);
bulletin.getRange(nextBullRow,1).setValue(bDayStudent);
bulletin.getRange(nextBullRow,1).setFontWeight("normal");
nextBullRow++ ;
}
}