I have a bunch of dates I need to convert to strings and put into an object.
sometimes however my date field is empty and it comes up as null
As far as I understand checking if something is truthy I can just check it with if(value) and it only runs if value is truthy - not null, undefined…
However even despite el.getCellValue(wipDate) comes up as null, my code still runs the blog inside the if statement.
Does anyone know what I’m doing wrong?
let month = '';
let year = null;
let dateObj = {'year':year, 'month':months[month]};
console.log(el.getCellValue(wipDate))
if(el.getCellValue(wipDate)){
//console.log('inside')
month = months[new Date(el.getCellValue(wipDate)).getMonth()]
year = new Date(el.getCellValue(wipDate)).getFullYear()
}