Pretty-time plugin

  • Tags : social, dates, time, timestamp
  • Latest : 2.1.3.Final-1.0.1
  • Last Updated: 12 February 2013
  • Grails version : 2.0 > *
12 votes
Dependency :
compile ":pretty-time:2.1.3.Final-1.0.1"

Documentation Source Issues

Summary

A plugin that allows you to display human readable, relative timestamps.

Installation

grails install-plugin pretty-time

Description

Requirements

  • Grails 2.0 or above
  • for Grails 1.x use version 0.3

Usage

<prettytime:display date="${someDate}" />

outputs:

"right now", "2 days ago", or "3 months from now"

Internationalization (I18n)

Build in - uses prettytime library translations. TagLib included in this plugin respects current locale.

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 is set by "default.date.format" in I18n.

Version History

  • 2.1.3.Final-1.0.1 - Small fix to "legacyResolve" which was introduced in Grails 2.1.3
  • 2.1.3.Final-1.0 - Refactored. Updated pretty-time library to latest version of the lib (2.1.3). @Janusz Slota: many thanks for your contribution!
  • 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.