Hi,
Is there a way to concat a var or a string in a ternary condition as shown below:
<sly>"${ properties.timezoneminute ? ":" ${properties.timezoneminute} : ":00"</sly>
Off course, this does not work. In the example, I want to show the timezone minutes if there is any chosen otherwise show just 00. EST+18:15, EST+19:00, etc... The "var" I am trying to concat is the Colon (":").
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Try this -
${properties.timezoneminute ? ${properties.timezoneminute} : [ ${properties.timezoneminute}, '00'] @ join=':'}
This is what you would want to use --
The join
option allows to control the output of an array object by specifying the separator string.
${['one', 'two'] @ join='; '} <!--/* outputs: one; two */-->
Views
Replies
Total Likes
See the HTL Spec - it gives an example -- htl-spec/SPECIFICATION.md at master · adobe/htl-spec · GitHub
Views
Replies
Total Likes
Try this -
${properties.timezoneminute ? ${properties.timezoneminute} : [ ${properties.timezoneminute}, '00'] @ join=':'}
This is what you would want to use --
The join
option allows to control the output of an array object by specifying the separator string.
${['one', 'two'] @ join='; '} <!--/* outputs: one; two */-->
Views
Replies
Total Likes
Thank you so much, that's the answer I needed. Just made a few changes in case someone is interested
${!properties.timezoneminute ? ":00" : [':', properties.timezoneminute] @ join=''}
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies