This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-eef557a3-a6a2-4af7-933e-88859435f64a XWIKI-23065 Open

Type Date not working with wikimacro.parameters

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-2cd8c5c1-1c69-46a4-9c1c-1371db2d1f5c James Wartell created this issue on 03/Apr/25 22:59
 
Summary: Type Date not working with wikimacro.parameters
Issue Type: cid:jira-generated-image-avatar-eef557a3-a6a2-4af7-933e-88859435f64a Bug
Affects Versions: 16.10.2
Assignee: Unassigned
Attachments: image-2025-04-03-15-47-48-280.png, image-2025-04-03-15-48-26-502.png, image-2025-04-03-15-49-50-172.png
Created: 03/Apr/25 22:59
Environment: Microsoft Windows Server 2022 Standard x64
Priority: cid:jira-generated-image-static-major-5468a12d-2463-4829-a8aa-33eb7dfdd82a Major
Reporter: James Wartell
Description:

The date converter and the date picker donot appear to use the same string format.

I guess this never got logged: https://forum.xwiki.org/t/type-date-not-working-with-wikimacro-parameters/12252


I'm having some additional goofiness where it isn't respecting my parameter name. Despite my parameter being named "yo" the parameter shows up in $wikimacro.parameters.getParameterNames() as "Date". It's type is String, which is why formatting it wasn't working I guess. Ironically if I name the parameter "date" it doesn't show up at all. 

Here is my parameter:

 


43527_image-2025-04-03-15-47-48-280.png

Here is my macro code:

{{velocity}}
$datetool.getClass() datetool #[[=]]# $datetool
$wikimacro.parameters.getParameterNames()
$wikimacro.parameters.date.getClass() wikimacro.parameters.date #[[=]]# $wikimacro.parameters.date
#if($wikimacro.parameters.date)
    $datetool.format($wikimacro.parameters.date)
#else
    {{error}}Select Date{{/error}}
#end
{{/velocity}} 

 
Here is my result after I select today's date:

class org.xwiki.velocity.internal.XWikiDateTool datetool = Apr 3, 2025, 3:38:28 PM
[Date]
class java.lang.String wikimacro.parameters.date = 2025/04/03 15:01
$datetool.format($wikimacro.parameters.date)​