Thank you – that looks very interesting - albeit too complex for me to debug. For me that yields an error
Evaluation Error: TypeError: Cannot read properties of undefined (reading ‘c’)
at eval (eval at (plugin:dataview), :22:31)
at Array.map ()
at Proxy.map (plugin:dataview:8038:39)
at eval (eval at (plugin:dataview), :18:8)
at DataviewInlineApi.eval (plugin:dataview:18370:16)
at evalInContext (plugin:dataview:18371:7)
at asyncEvalInContext (plugin:dataview:18381:32)
at DataviewJSRenderer.render (plugin:dataview:18402:19)
at DataviewJSRenderer.onload (plugin:dataview:17986:14)
at e.load (app://obsidian.md/app.js:1:631421)
At least when the suggested code is used as below (perhaps not as intended). Many thanks for the help.
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.
A quick note - the code I just pasted does not check if eventdate is a valid date. If you have some files with for example eventdate: random text then that could also lead to an error. So it could be worth adding an if-statement to check if the field is a valid date
You don’t have anything which verifies that eventdate actually exists in your result set in your query. This means that there is a likelihood of not set in which case k.eventdate.c.year will trigger error messages like the one you’ve quoted.
In other words, one of your files don’t have a set eventdate. To fix this you would either do a query to locate the offending files, or change the query so that the map only occurs if it’s set. A final option is doing k.eventdate?.c.year (maybe just the question mark without the period), which will allow for event date to be null, which would then render the whole expression as null. (However, this fix might result in other error messages, or that todays date is returned)