[
https://issues.apache.org/jira/browse/SLING-6102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15742545#comment-15742545
]
ASF GitHub Bot commented on SLING-6102:
---------------------------------------
GitHub user vladbailescu opened a pull request:
https://github.com/apache/sling/pull/191
Added implementation for date and number formatting to HTL
* SLING-6102 - Adding formatter to HTL/Sightly dates …
* SLING-6140 - Adding number formatting to Sightly/HTL
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vladbailescu/sling format-multiple
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/sling/pull/191.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #191
----
commit 6927a1e48e9d0ab229edb668d2beb78c7dcda5c3
Author: vladbailescu <[email protected]>
Date: 2016-11-25T20:40:02Z
SLING-6102 - Adding formatter to HTL/Sightly dates
SLING-6140 - Adding number formatting to Sightly/HTL
* Updated HTL compiler and filters, adapted tests
* Updated formatting extension
* Added some convenience methods to RuntimeObjectModel
* Updated TCK reference
* Added some sample translations for locale verification
commit b593e42f25b80df12785e8e3c83b1f2a6fa37e64
Author: vladbailescu <[email protected]>
Date: 2016-11-30T12:16:53Z
SLING-6102 - Adding formatter to HTL/Sightly dates
SLING-6140 - Adding number formatting to Sightly/HTL
* Updated constants visibility and usage
commit aaa77609edf3c6fd39ccdeda405ed45d33fddc66
Author: vladbailescu <[email protected]>
Date: 2016-12-12T17:32:00Z
SLING-6102 - Adding formatter to HTL/Sightly dates
SLING-6140 - Adding number formatting to Sightly/HTL
* Updated performance tests to include date formatting
----
> 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)