Create a macOS Photos "On this day" using AppleScript

set  thisday  to  the  day  of  (the  (current  date)  as  date)  —Defaults  to  today  or  change  this  to  the  day  you  want,  for  example  "25".
set  thismonth  to  the  month  of  (the  (current  date)  as  date)  —  Defaults  to  today  or  change  this  to  the  month  you  want,  for  example  "december".
set  thisDayAlbum  to  "On  "  &  thismonth  &  "  "  &  thisday  as  string  
tell  application  "Photos"
       try
               if  exists  container  thisDayAlbum  then
                       set  thePhotosBuffer  to  container  thisDayAlbum
               else
                       make  album  named  thisDayAlbum
       end  if
       on  error  errTexttwo  number  errNumtwo
                 display  dialog  "Cannot  open  album:  "  &  thisDayAlbum  &  "  "  &  errNumtwo  &  return  &  errTexttwo
               return
       end  try
       set  onthisdayFound  to  {}
       set  onthisdaySkipped  to  {}
       set  allTheItems  to  every  media  item  --  get  a  list  of  all  photos  and  videos;  this  may  take  a  while
       --  add  all  photos  taken  this  day  to  the  album
       repeat  with  i  from  1  to  the  count  of  allTheItems
               --  check  the  dates  of  all  photos  and  videos
               set  thisMediaItem  to  item  i  of  allTheItems
               try
                       set  date_i  to  the  date  of  thisMediaItem
                       set  day_i  to  the  day  of  (date_i  as  date)
                       set  month_i  to  the  month  of  (date_i  as  date)
                       if  ((day_i  =  thisday)  and  (month_i  =  thismonth))  then
                               set  end  of  onthisdayFound  to  thisMediaItem
                               add  {thisMediaItem}  to  container  thisDayAlbum
                       end  if
               on  error  errTexttwo  number  errNumtwo
                       set  end  of  onthisdaySkipped  to  thisMediaItem
               end  try
       end  repeat
end  tell
set  theresultmessage  to  "Found  "  &  (the  count  of  onthisdayFound)  &  "  items  and  added  them  to  the  album  "  &  thisDayAlbum  &  ".
Skipped  "  &  (the  count  of  onthisdaySkipped)  &  "  items  without  date"
display  dialog  theresultmessage