0

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>
Zabuzard
  • 25,064
  • 8
  • 58
  • 82
  • What programming language did you use @Vishnu? –  Dec 08 '17 at 22:56
  • Hey @MacStevins, this is a simple "Hello World" type experiment where I tried to render a HBS file using the data from a JSON file. More on Handlebars: https://github.com/jknack/handlebars.java – Vishnu Vardhan Dec 08 '17 at 22:58
  • String helpers on page: https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/helper/StringHelpers.java – Vishnu Vardhan Dec 08 '17 at 23:01

1 Answers1

0

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.

Tristan
  • 279
  • 5
  • 21