AnsweredAssumed Answered

Help with using the bbNG tag dateRangePicker

Question asked by becker01 on Jan 15, 2018
Latest reply on Jan 15, 2018 by vickers.stephen

Hi,

I am trying to understand the bbNG dateRangePicker tag by creating a settings page where I would like to use this tag to automatically switch a setting option on or off. This is my current code:

 

 

<bbNG:dataElement label="Set Maintenance Window" >
        
    <c:choose>
        <c:when test= "${startDateTime == null && endDateTime == null}" >

            <bbNG:dateRangePicker baseFieldName="libMaintWin"
                      startCaption = "Start "                                      
                      endCaption = "Finish"
                      showTime = "true"
                      suppressInstructions = "true"
                      startDateTime = "${libMaintWin_start_datetime}"
                      endDateTime = "${libMaintWin_end_datetime}"/>                        
        </c:when>

        <c:otherwise>

            <%-- Takes the string startDateTime and converts into a Calendar function --%>
            <bbNG:hiddenElement 
                name="startDateTime_internal"
                value="bbNG:stringToCal(libMaintWin_start_datetime)"/>

            <bbNG:hiddenElement
                name="endDateTime_internal"
                value="bbNG:stringToCal(libMaintWin_end_datetime)"/>            


            <bbNG:dateRangePicker baseFieldName="libMaintWin"
                      startCaption = "Start "                                      
                      endCaption = "Finish"
                      showTime = "true"
                      suppressInstructions = "true"
                      startDateTime = "${startDateTime_internal}"
                      endDateTime = "${endDateTime_internal}"/>    
        </c:otherwise>

    </c:choose>

</bbNG:dataElement>

 

The Date Picker displays correctly and dates and times can be set. The settings pass as Strings into the settings file.

My Web APP is using Spring MVC and the controller gets the the date and time strings as set in the JSP and displays them correctly (verified by accessing the log file).

 

When I try to examine the B2 settings again from the Building Block Installed Tools UI, I get the following error message:

Cannot convert 2018-1-9 14:30:00 of type class java.lang.String to class java.util.Calendar

 

I realise that there is a conversion mismatch as the API info states that the dateTime string must be converted into a calendar variable - but could anyone advise me where my thinking has gone awry...

 

Thanks.

Outcomes