Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#394 closed enhancement (fixed)

Fuzzy timestamps

Reported by: Jef van Schendel Owned by: Jessica Tallon
Priority: minor Milestone: 0.4.0
Component: programming Keywords:
Cc: deletesoftware@… Parent Tickets:

Description

Current: "Added on 2011-02-14."

Better would be: "Added 1 month ago."

This also goes for comment timestamps, which are currently shown as "08:35PM 2012-02-09" which is all kinds of horrible.

I have no idea how to do this though. It might already be possible with the software we're using, who knows. It also wouldn't be hard to find a jQuery plugin such as http://timeago.yarp.com/, but I'm not sure if that's the right way to go.

Attachments (1)

timesince.patch (10.7 KB ) - added by Jessica Tallon 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Aleksej, 12 years ago

Cc: deletesoftware@… added
Milestone: 0.2.1
Priority: blockerminor

comment:2 by Aleksej, 12 years ago

It must still be possible to get the absolute value with some precision (unless the uploader or site owner hides it, if that’s possible).

comment:3 by Christopher Allan Webber, 12 years ago

Component: component1programming

comment:4 by ShawnRisk, 12 years ago

Owner: somebody removed
Status: newassigned

comment:5 by Jessica Tallon, 11 years ago

Owner: set to Jessica Tallon
Status: newassigned

comment:6 by Christopher Allan Webber, 11 years ago

So I say that we add this feature but... I think that aleksej is right that we want to be able to get the absolute value with precision. Thankfully, there's a really easy option for that:

  <span title="exact date here">1 month ago</span>

As for implementation, several things:

  • We could implement this ourselves, or we could lift the timesince utility out of django (django/utils/timesince.py). Implement this as a generic function somewhere in mediagoblin/tools/
  • We'll definitely want tests for this utility, so please add them. Again, if adapting from Django, we can borrow and adapt their test.
  • Just be sure if adapting from Django that we follow: http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
  • We'll also then want to pass this into the global template context. It seems this would be useful pretty much everywhere, so see where we add common utilities to templates in mediagoblin.tools.template:get_jinja_env
  • Then you'd want to make use of it in the appropriate templates. In fact, wrapping it in a span might be a common enough operation that you might want to add a macro to the utils/ templates section... that's optional though.

That should do it, I think... happy to answer questions!

by Jessica Tallon, 11 years ago

Attachment: timesince.patch added

comment:7 by Jessica Tallon, 11 years ago

I've put it on a branch (394-fuzzy-timestamp) which you can find:
https://gitorious.org/~tsyesika/mediagoblin/tsyesikas-mediagoblin/commits/394-fuzzy-timestamp

comment:8 by Christopher Allan Webber, 11 years ago

Resolution: fixed
Status: assignedclosed

I merged it!

AWESOME work Tsyesika! You picked this up and ran with it super fast!

comment:9 by Christopher Allan Webber, 11 years ago

Milestone: 0.4.0
Note: See TracTickets for help on using tickets.