[ 
https://issues.apache.org/jira/browse/SLING-6102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15571937#comment-15571937
 ] 

Feike Visser edited comment on SLING-6102 at 10/13/16 1:43 PM:
---------------------------------------------------------------

I added support now for locales, thanks for raising this


was (Author: fvisser):
I added support now for locales, thank for raising this

> Adding formatter to HTL/Sightly dates
> -------------------------------------
>
>                 Key: SLING-6102
>                 URL: https://issues.apache.org/jira/browse/SLING-6102
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Feike Visser
>
> When using Sightly we are missing functionality to format dates.
> Proposed solution:
> {code}
> @ dateFormat = '<date format>'
> {code}
> format used can be found in : 
> http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
> The value to be formatted must be specified via a Date-type (Date,Calendar 
> etc)
> Example
> {code}
> <body data-sly-use.obj="logic.js" data-sly-use.dateV="java.util.Date">
>   ${ dateV @ dateFormat='dd/MM/yyyy'}
>   ${ obj.jsdate @ dateFormat='dd/MM/yyyy'}
>   ${ properties.jcr:created  @ dateFormat='dd/MM/yyyy' }
>   ${ obj.jsdate @ dateFormat='dd/MMM/yyyy', locale='ko_KR' } // korean locale
>    ${ obj.jsdate @ dateFormat='dd/MMM/yyyy', locale='fr_FR' } // french locale
>    ${ obj.jsdate @ dateFormat='dd/MMM/yyyy' } // locale from request
> </body>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to