Change date color when the date has been reached

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

1 answer

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published 8 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

85 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you