calendar_view_dayScript services to display dates in a nice way.
TypeJAR
CategoryAPI
Developed by

XWiki Development Team

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

This script services offer some methods to display dates in a pretty way, and supporting a lot of locales (contrary to $datetool). It is currently based on PrettyTime.

{{velocity}}
## Example 1:
$services.date.displayTimeAgo($datetool.date())
## Displays: moments from now ("à l'instant" in French)

## Example 2:
$services.date.displayTimeAgo($xwiki.jodatime.dateTime.minusMinutes(12).toDate())
## Displays: 12 minutes ago ("il y a 12 minutes" in French)

## Example3: You can also specify the locale you want
$services.date.displayTimeAgo($xwiki.jodatime.dateTime.minusHours(1).toDate(), "es")
## Displays "hace 1 hora"
{{/velocity}}
Tags:
Created by Guillaume Delhumeau on 2018/05/17 18:09
    

Get Connected