I want to create a macro in velocity with a date as macro-parameter.
In the object of WikiMacroParameterClass with the name “someDate” I put as parameter type “java.util.Date”.
Inserting the macro in a page with WYSIWYG Editor I can double-click the macro and then fill the field of someDate. The Date-Picker ist working fine. So far, so good.
The problem is:
I can’t access the value of the choosen date in the macro code via wikimacro.parameters.someDate
The following macro-code
$wikimacro.parameters.someDate
$wikimacro.parameters.someDate.class
{{wikimacroparameter name="someDate"/}}
$xcontext.macro.params.someDate
$xcontext.macro.params.someDate.class
produces as output:
$wikimacro.parameters.someDate
$wikimacro.parameters.someDate.class
2023/04/20 12:00
2023/04/20 12:00
class java.lang.String
As one can see:
- The choosen date is accessible as a string via $xcontext.macro.params.someDate, but this method is considered as deprecated.
- The value is printable via the macro wikimacroparameter.
- But in the variable $wikimacro.parameters.someDate there seems to be nothing at all. Why?
My version: XWiki Debian 14.10.3