#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)
Change History (10)
comment:1 by , 13 years ago
Cc: | added |
---|---|
Milestone: | 0.2.1 |
Priority: | blocker → minor |
comment:2 by , 13 years ago
comment:3 by , 12 years ago
Component: | component1 → programming |
---|
comment:4 by , 12 years ago
Owner: | removed |
---|---|
Status: | new → assigned |
comment:5 by , 12 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:6 by , 12 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 inmediagoblin/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 , 12 years ago
Attachment: | timesince.patch added |
---|
comment:7 by , 12 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 , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I merged it!
AWESOME work Tsyesika! You picked this up and ran with it super fast!
comment:9 by , 12 years ago
Milestone: | → 0.4.0 |
---|
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).