A while back one of you kind people gave me the following script to calculate the day of the week from the date;
let dy = new Date(field('date'));
if (dy.getFullYear() >= 1800) {
moment(field('Date')).format('dddd');
} else {
null;
}
This works perfectly if the date is present and valid.
I am now using it in a different library where the date field (quite correctly) is sometimes empty.
This produces an 'Invalid Date' entry in the Day field.
I would prefer it to just leave the Day field empty also.
Could somebody please suggest an amendment to the above to achieve this please
Thanks