Date output format in dataviewjs

Hmm ok. I think the error happens because of the map-function. It tries to convert the eventdate-field on every page to a new Date. So when a page doesn’t have a value in eventdate (or the value is not a valid date) then this error occurs.

Does this code below help?

.map(k => {
	let eventdate = "no date";
	if (k.eventdate != null) {
		eventdate = moment(new Date(k.eventdate.c.year, k.eventdate.c.month -1, k.eventdate.c.day)).format('YYYY-MM-DD');
	}
	return [
		eventdate,
        k.who,
        k.description, 
        k.priority,         
        k.latextodo,
        k.mstodo,
        k.otheraction,
        k.file.link 
      ]];
}