Change date color when the date has been reached

Niels Geursen July 3, 2017

I would like to make a list with products and there expiration date. To make the list more clear I would like to change the font color to RED when the date has been reached.

Is this possible this would be very handy.

Thanks in advance.

Niels

2 answers

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2023

If you create a separate page for each product, then you can easily set an expiration date to them with the Better Content Archiving for Confluence app.

When the expiration is approaching, the date turns to yellow, and when it is passed, it turns to red:

content-status-indicator-cloud.gif

0 votes
John Corwith July 7, 2017

As far as I know, you are going to need a User Macro and admin permissions to install it.

Here's one I wrote that does more than what you were asking for which you can tweak. I don't know if/when HTML 5 compatiblity will be an issue for Confluence so this is HTML 5 compatible.

Your list will be a list of macro boxes. Enter your product name/text whatever in the macro box ($body) and edit the macro to set the expiration date for each product.

## Macro Name: expdatehighligher

## Macro Title: Expiration Date Highlighter

## Macro Body Processing: Escaped

## @param endDate:title=Expiration Date|type=date|required=true|desc=mm/dd/yyyy

#set ($endDate = $content.currentDate)

#set ($currentDate = $content.currentDate)

$endDate.setTime($content.currentDate.parse($paramendDate))

#if($currentDate.before($endDate))

<p>$body $paramendDate</p>

#else

<p style="color:white; background-color:red; font-weight:bold">$body $paramendDate</p>

#end

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events