PrettyTime Plugin
This plugin allows you to display human readable, relative timestamps. It is based on
PrettyTime OpenSource time formatting library.
Requirements
- Grails Version: 1.0 and above
- JDK: 1.5 and above
Installation
grails install-plugin pretty-time
Usage
<prettytime:display date="${someDate}" />Generates timestamps like:
"right now", "2 days ago", or "3 months from now"
Internationalization
- check the "message.properties" file from the plugin directory.
Tag attributes
| Attribute | Description |
|---|
| date | The date object to format. |
| capitalize | Capitalize the output text (default: false). Ex: "moments ago" -> "Moments ago". |
| showTime | Show the time (default: false). Ex: "2 days ago, 12:00:25 AM". |
| format | The format to use for the date (default: "hh:mm:ss a"). The default value can be modified adding "plugin.prettytime.format" property to "message.properties" file). |
Version History
- 0.3 - Upgraded pretty-time library and added 2 tag attributes: "showTime" and "format".
- 0.2.1 - Fixed blank spaces.
- 0.2 - Added support for DateTime class of Joda-Time; added "capitalize" tag attribute.
- 0.1 - First official release.
Suggestions, comments or bugs
Feel free to submit questions or comments to the
Grails users mailing list.
Alternatively you can contact me directly - cazacugmihai at gmail dot com
Please report any issues to the
Grails users mailing list and/or write up an issue in JIRA at
http://jira.codehaus.org/browse/GRAILSPLUGINS under the Grails-PrettyTime component.