Dataviewjs query works in Live Preview but not in Reading Mode

Hey,
the following dataviewjs query renders in live preview mode but not in reading mode. Did I make there some mistake or is this a bug?

// find dates based on format [[YYYY-MM-DD]]

const findDated = (task)=>{
if( !task.completed ) {
task.link = " " + "[[" + task.path + "|*]]";  
task.date="";

const found = task.text.match(/\[\[([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))\]\]/);

if(found) task.date = moment(found[1]);
return true;  
}

}

const myTasks = dv.pages("").file.tasks.where(t => findDated(t));

const overdue = myTasks.filter(t=> moment(t.date).isBefore(moment(),"day")).sort(t=>t.date)
if(overdue.length > 0) {
	dv.header(2,"Overdue");
	dv.taskList(overdue);
}

const today = myTasks.filter(t=> moment(t.date).isSame(moment(),"day")).sort(t=>t.date)
if(today.length > 0) {
	dv.header(2,"Today");
	dv.taskList(today);
}

const upcoming = myTasks.filter(t=> moment(t.date).isAfter(moment(),"day")).sort(t=>t.date)
if(upcoming.length > 0) {
	dv.header(2,"Upcoming");
	dv.taskList(upcoming);
}