looking for correct function to compare year in conditional visibility for input widget

0
Our project is in Studio Pro 8.6.9.   I am trying to show or hide an input field based on the year of the selected date for another input on the same page but have not found the correct function or expression to do so.   I have a Date picker input widget for our ProjectEndDate attribute.   When the year of the selected date for ProjectEndDate is > than the current year, a 2nd input field should become visible.  Otherwise, the 2nd input field should remain hidden.   In the “Condition for visibility”  pop-up of the 2nd input, I tried a few different functions and expressions to try to compare the years.   Both of the following expressions actually respond correctly onscreen, in terms of showing/hiding the 2nd input field, based on the year of the selected date for the ProjectEndDate.  But each version results in a Console error (shown pasted after each expression below):    trimToYears($currentObject/ProjectEndDate) > trimToYears([%EndOfCurrentYear%]) An error occurred while evaluating visibility expression: Operator trimToYears not supported in expression trimToYears() Error: An error occurred while evaluating visibility expression: Operator trimToYears not supported in expression trimToYears()    $currentObject/ProjectEndDate > [%EndOfCurrentYear%] An error occurred while evaluating visibility expression: Operator > not supported in expression >(, Fri Dec 31 2021 23:59:59 GMT-0500 (Eastern Standard Time)) Error: An error occurred while evaluating visibility expression: Operator > not supported in expression >(, Fri Dec 31 2021 23:59:59 GMT-0500 (Eastern Standard Time))   Please let me know, if you know the correct function to use for this.  Thank you 
asked
1 answers
0

Hi Dawn, 

The following expression will work to compare year between datetime and other tokens.

 parseInteger(formatDateTime([%CurrentDateTime%],'yyyy')) >
 parseInteger(formatDateTime([%EndOfCurrentYear%],'yyyy'))

answered