Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-23065

Type Date not working with wikimacro.parameters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.10.2
    • None
    • None
    • Microsoft Windows Server 2022 Standard x64
    • Unknown

    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:

       


      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)​

      Attachments

        1. image-2025-04-03-15-47-48-280.png
          30 kB
          James Wartell
        2. image-2025-04-03-15-48-26-502.png
          27 kB
          James Wartell
        3. image-2025-04-03-15-49-50-172.png
          19 kB
          James Wartell

        Activity

          People

            Unassigned Unassigned
            jameswartell James Wartell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: