Sightly Extension to format dates | Community
Skip to main content
Level 2
October 16, 2015
Solved

Sightly Extension to format dates

  • October 16, 2015
  • 1 reply
  • 1301 views

With JSP/JSTL there is the tag <fmt:formatDate> to format dates according to the current locale. With Sightly there is currently not such an extension and also custom extensions are not supported (see questions at http://dev.day.com/content/ddc/en/gems/introduction-to-sightly/_jcr_content/par/download_0/file.res/Introduction%20to%20Sightly%20Q_As.pdf). What should we do to do date formatting properly. I don't want to do the formatting in my model class because that is clearly functionality belonging to the view.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by PaulMcMahon

Can't you just create a reusable function in the Use API. You could create a JavaScript file or Java class and then pass in the data and the format String as parameters just as you would with <fmt:formatDate>. 

1 reply

PaulMcMahonAccepted solution
Level 8
October 16, 2015

Can't you just create a reusable function in the Use API. You could create a JavaScript file or Java class and then pass in the data and the format String as parameters just as you would with <fmt:formatDate>.