Automatically update date difference in Writer

I’m currently writing a CV using LibreOffice Writer, and in one section I include the number of years that I have been using various programming languages. I would like these numbers to be updated automatically so that I don’t have to do the date calculations in my head every time I update my CV in the future.

For example, my CV currently contains the text “JavaScript: 2 years”. If I edit the file again this time next year, I would like it to automatically update to “JavaScript: 3 years”.

This is possible in LibreOffice Calc using e.g. DATEDIF, but I haven’t been able to make this work in Writer. Is there a way?

Wouldn’t it be easier to write “Since …”?

You cannot use any of the Calc functions in Writer and even the few functions possible in a Writer-Table have their own definitions, different from Calc.

The only way to get the actual date in Writer, is the field variable “Date” (available from tab “Document” in “More Fields…”). But even with its “Offset in days” you get a date and not an amount of days, months or years. The only way to get what you wish, would be to write a macro.

Writing “since YYYY” is unfortunately not an option - it has to be the number of years. Writing a macro does sound like the right way to do it, although I don’t know if I want to expend the effort to learn how to do it right now.

Additional to @Regina :
Maybe you can fake such Date-field with an Offset for Example -5000
and formatted to show only last 2 digits of Year

That was my first thought too and I have tried it, but you end up with 02 instead of 2.

I sort-of managed to make it work using the “E” format code (number of the year within a Japanese era), which doesn’t have a leading zero. Unfortunately this will break when the era changes, which is whenever Japan has a new emperor, so it won’t work long-term.