Sudden error in 1 year old function

Solved it temporarily with this workaround (if anyone else run into it):

function fnCheckDataTypeForStringBug(datAnyDate) {
// 03/09/2018 workaround for bug that returns a Date as a String in Publish Mode. If it is one, convert it to Date type
let thisNewDate
if ( typeof datAnyDate === “string”) {
thisNewDate = new Date(datAnyDate)
} else {
thisNewDate = datAnyDate;
}
return thisNewDate;
}