Using Calc formulas in libreoffice Writer

I have a document spanning over several pages. To reuse dates and other data I use fields. Some of the fields are dates and at one place I want to use two dates to calculate and print the number of days between those.

Libreoffice documentation insinuates that the formula mechanism from Calc can be used in Writer but when using names they will resolve to variable names rather than cell names. So I prepared to variables for dates by setting them at the beginning of the document. I then tried to insert a formula using the DATEDIF function.

It failed returning

 ** Fehlerhafter Ausdruck **

meaning the formula isn’t correct. I wasn’t unsure if my variables weren’t resolved correctly so I tried to use fixed date strings like this:

=DATUMDIF("2025-05-07";"2025-09-09";"d")

Note that DATUMDIF is just the German version of DATEDIF, but I also had tried the English operators. The outcome resulted in the same error.

To be sure, I tried simple calculations with some numbers which worked fine.

So did I misunderstand the documentation and formulas like these cannot be used in Writer? Or do they have to be formatted differently?