Unable to format the date in Handlebars.java using {{now}}

1.3k Views Asked by At

I am trying to render the present date using Handlebars in Java. While using the {{now}} handlebar, I am able to print the date as "Dec 8, 2017":

<ul>
 {{#items}}
 {{name}}

     {{now}}

 {{/items}}
</ul>

But when I try to format the date by passing a parameter, I am getting a null value. Am I doing something wrong here? -

<ul>
 {{#items}}
 {{name}}

     {{now ["full"]}}

 {{/items}}
</ul>
1

There are 1 best solutions below

3
On BEST ANSWER

I'm not sure what version of Handlebars, but you may need to specify the format in there?

{{now ["format"] [DateFormat.FULL]}}

Otherwise this would be a good place to look.