Sign in to edit and +1 items.
Login required
Download

PrettyTime

(6)
Author(s) Cazacu Mihai
Current Release 0.3   (2 years ago)
Grails Version 1.1.1 > *
Tags dates  social  time  timestamp 
Dependency
compile ":pretty-time:0.3"
PrettyTime is an OpenSource time formatting library. Completely customizable, PrettyTime creates human readable, relative timestamps like those seen on Digg, Twitter, and Facebook. It’s simple, get started “right now!” and in over 18 languages!
Last updated by admin 2 years ago
grails install-plugin pretty-time
Last updated by lincolnthree 1 month ago

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

AttributeDescription
dateThe date object to format.
capitalizeCapitalize the output text (default: false). Ex: "moments ago" -> "Moments ago".
showTimeShow the time (default: false). Ex: "2 days ago, 12:00:25 AM".
formatThe 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.

Last updated by admin 2 years ago
Last updated by admin 2 years ago