How to show text in Writer only after a certain date

I’m trying to create a Writer document where certain sections are hidden until a certain date (different dates for different sections). I have tried to hid them with a condition where I use the TODAY() function from Calc, hoping that it would work. Obviously it doesn’t. It seems that hidden sections with conditions would be the logical path, but I’m stuck.
I am looking for a solution which doesn’t involve macros, if at all possible.

I would appreciate any help. Thanks in advance!

I’m using LibreOffice 6.4.7.2 on Linux Mint.

You can use a field for each condition: Insert - Field - More Fields..., select Variables tab. At the bottom, type a name for your date variable (let’s say “date1”) and set a value, you can select a date format in the list box in the top right corner (Additional formats), then insert. You probably want to insert the date fields near the sections, but I don’t know if that matters.
In the condition for hiding the section, enter today() LEQ date1.
I found that when you edit the condition, the variable field tends to get deleted, which is annoying to say the least. I don’t know if that’s intended behavior or a bug.

Can’t reproduce that anymore. It seems that the Today() function doesn’t work correctly in that condition. Maybe somebody should file an enhancement request to allow such functions there.

Thanks for your answer. Unfortunately it doesn’t seem to work. I was trying this same approach with <= instead of LEQ, but neither option works. I have even tried as a formula field “today()”, just to simply show the current date, and it doesn’t work either, so it looks to me like you cannot use it in Writer formulas (I have tried “today” and “hoy”, because I use the Spanish version; neither works).

I did notice when I tested floris_v method that variable date1 got changed to Date1 during changing the date to test, causing test to fail. After changing the name in the conditional formula to Date1 the hiding worked again.

1 Like

It hides the section alright, but I can’t make it unhide it when the condition isn’t met. :angry:

I don’t know, it doesn’t work at all for me. I have a variable field (called Anno) with the date 01/09/2021 (1 September, that is). And then I format a section to Hide with the condition “today() LEQ Anno + 61”, which should hide it until 61 days after the Anno date (in other words, until 1 November). But the section gets hidden immediately, although we are well beyond 1 November.
Testing further, with the condition “today() L today()” it also gets hidden. How is this possible? My guess is, again, that the function “today()” cannot be used in this context.

Same for me :frowning:

No time for experimenting today (back from a straining trip) but Writer is not a spreadsheet app. So arithmetics like date+no_of_days will probably not wotk the way you expect. In Writer variables may contain integer or strings. Personally, I never met function today(). I don’t think it exists; consequently if the formula is not rejected, it returns “void”.

IMHO, there is no “non-macro” solution to your question because you can’t copy a variable value into another variable. More precisely, you can insert the last-modified-date of your document into a field. Unfortunately, this field can’t be transformed into a variable, which is needed to encode a condition like yours.

Yeah, I was kind of realizing that… Thanks for your answer (all of you, guys)!