You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2016/12/14 21:34:58 UTC

[jira] [Resolved] (SLING-6102) Adding formatter to HTL/Sightly dates

     [ https://issues.apache.org/jira/browse/SLING-6102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Cotescu resolved SLING-6102.
---------------------------------
    Resolution: Invalid

I'm marking this issue as invalid since [~vladb] submitted a PR that implements support for the {{format}} option like described in the draft 1.3 version of the HTL Language Specification at https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/1.3/SPECIFICATION.md#122-format.

> 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
>            Assignee: Radu Cotescu
>
> 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
>   ${ obj.jsdate @ dateFormat='dd/MMM/yyyy HH', locale='fr_FR', timezone='PST' } // french locale, timezone set to PST
>   ${ obj.jsdate @ dateFormat='dd/MMM/yyyy HH', timezone='CTT' } // timezone set to CTT
> </body>
> {code}



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