And in all of these tests, the dynamic command of the templater did not work in the frontmatter but worked correctly in the body.
Am I doing something wrong?
UPDATE:
Thanks to other tests and a question on Reddit I reached a “solution”.
The dynamic commands can’t be embedded in the YAML file because, as metadata, they can’t be dynamic.
The solution found is to encapsulate the modified date with apostrophes in order to render the date in preview mode.
this result is fine because my goal was to “only” see the creation and last modified date in the metadata block and for querying them I can always use the Dataview native “file.ctime” and “file.mtime”.
I really don’t have an answer on why if you use apostrophes it works as I wanted.
Probably the string format is rendered in preview mode and the date format no.
This is actually something to look into.