Hey there!
I am working on a custom macro for Confluence. It should check whether the last modification date of the current page is older than X.
I am stuck with not being able to make sense of the format differences between $content.currentDate and $content.lastModificationDate.
## @param older:title=From Date|type=enum|enumValues=30 Tage, 90 Tage, 180 Tage, 365 Tage
#set( $currentD = $content.getCurrentDate())
#set( $currentOb = $content.currentDate)
#set( $res = $currentOb.setTime($content.currentDate.parse($currentD)))
#set( $currentDI = $currentOb.getTime())
## Gets the date of the last modification and transforms it to a timestamp
#set( $modD = $content.getLastModificationDate())
#set( $modOb = $content.lastModificationDate)
#set( $res = $modOb.setTime($content.lastModificationDate.parse($modD)))
#set( $modDI = $modOb.getTime())
<h3>Naked Dates</h3>
<p>Mod: $content.lastModificationDate<br>
Current: $content.currentDate</p>
<h3>Timestamps</h3>
<p>Mod: $modDI<br>
Current: $currentDI</p>
The output looks like this:
Naked Dates
Mod: 2024-03-22 00:40:32.69
Current: Fri Mar 22 01:12:56 CET 2024Timestamps
Mod: $modDI
Current: 1711066376496
BTW, I am not married to using timestamps … I was trying this, because I could not get $modOb.after(…) to work either …
I am pretty sure I am missing something very obvious :) Any ideas?
Thanks
Sascha
Both getCurrentDate() and getLastModificationDate() should return a Date object … https://docs.atlassian.com/atlassian-core/4.3/xref/com/atlassian/core/bean/EntityObject.html
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.