It seems the following code
works incorrectly in WordPress for dates before January 1st 1970, as it returns current year instead of the post date.
It this case it can be fixed easily with this replacement:
substr($post->post_date, 0, 4)
That is enough to make the OnThisDay plugin to show correctly the records about historical events in the past.