Dataviewjs / Moment.js issue calcuating days since task complete

Hello everyone! I am using a dataviejs snippet to show when I last did things, for example workouts. However since recently, this has stopped working! It displays completely false values! Generally, the days since I last done the thing are too much, but they still link to a valid note where I’ve done the specific thing, but just not the most recent one.

The snippet:

dv.el('p','---')

let all_daily_with_date = dv.pages('#daily').filter(page => page.file.frontmatter.date =! undefined)

function getPagesCompletedTask(keyword) {
  return all_daily_with_date.filter(
    p => p.file.tasks.filter(task => task.text.includes(keyword) && task.completed).length !== 0
  ).sort(p => moment(p.date,"DD.MM.YYYY").toDate())
}

function getDaysSince(tasktext){
    let lastoccurence = getPagesCompletedTask(tasktext).first()
	let lastocc_date = moment(lastoccurence.date,"DD.MM.YYYY").toDate();
	//console.log(lastoccurence.file.path,lastoccurence.file.frontmatter.date,lastoccurence.date) yeah somehow this is weird but p.date works
    return [Math.ceil( (dv.date('today') - lastocc_date) / (1000 * 60 * 60 * 24)),lastoccurence]
}



for (const category of ['sport','ill','read']){
    let info = getDaysSince(category)
    dv.el('p',`${info[0]} Tage seit ${category} [ ${info[1].file.link} ]`)
}

My daily notes look like:

---
tag: daily
date: 23.04.2024
---

## Tracking
- [ ] sport
- [ ] ill

Since it is showing the wrong daily notes, I suspect something is wrong with date parsing / handling but I cant figure out why. Also, on some days the displayed daily notes seem to switch to older or newer ones.

Thanks everyone!
Maxi