April 20th, 2010 by Lincoln Baxter III

PrettyTime 1.0.6 Released – New Languages, Thread-Safety

OcpSoft PrettyTime is an open-source time-formatting library for creating human-readable timestamps like, “in 3 minutes,” or “moments ago.” — intuitive, easy, extendable. Visit the home page to download and learn more about using PrettyTime. New features in this release: Thread Safety, Java 1.5 compatibility, extra languages.
<dependency>
	<groupId>com.ocpsoft</groupId>
	<artifactId>ocpsoft-pretty-time</artifactId>
	<version>1.0.6</version>
</dependency>

New Features:

Several new languages are supported out-of-the-box in Version 1.0.6:

Thread safety:

In addition to new translations — PrettyTime 1.0.6 is now Thread-Safe (why you would want to share a PrettyTime object is unknown to us, but now you can do it with confidence.)

Java Version 1.5 support:

PrettyFaces had erroneously been “updated” to require Java 1.6; it is now Java 1.5 compliant once more, and can be used on all of your favorite JVMs.

Example:

A quick intro to PrettyTime using JUnit:
public class PrettyTimeTest
{
 @Test
 public void testMinutesFromNow() throws Exception
 {
    PrettyTime p = new PrettyTime(new Date(0));
    assertEquals("12 minutes from now", p.format(new Date(1000 * 60 * 12)));
 }
}

Posted in Releases

2 Comments

  1. Dan Allen says:

    I like the use of a unit test to demonstrate the library in use! That should be considered a best practice for release announcements 😉

  2. […] nice library therefore is PrettyTime. 0.000000 […]

Leave a Comment




Please note: In order to submit code or special characters, wrap it in

[code lang="xml"][/code]
(for your language) - or your tags will be eaten.

Please note: Comment moderation is enabled and may delay your comment from appearing. There is no need to resubmit your comment.