diff --git a/lib/converters/genericConverter.js b/lib/converters/genericConverter.js index b1b8f37e4..3b39bb95f 100644 --- a/lib/converters/genericConverter.js +++ b/lib/converters/genericConverter.js @@ -13,7 +13,8 @@ exports.iobState2EntityState = function (entity, val, attribute) { } else if (typeof val === 'number' && entity.attributes && ['timestamp'].includes(entity.attributes.device_class)) { return val; //do not convert timestamps. } else if (typeof val === 'number' && entity.attributes && ['date'].includes(entity.attributes.device_class)) { - return new Date(val).toDateString(); //convert to date string + const dateStr = new Date(val).toDateString(); //convert to date string + return dateStr === 'Invalid Date' ? 'unknown' : dateStr; } else if (type === 'lock') { return val ? 'unlocked' : 'locked'; } else if (typeof val === 'boolean' && type !== 'media_player') {