Currently it is hardcoded as browser current time, but it would be usefull to allow user specify that is current time (something like this http://gist.github.com/398904).
In my case it necessary because I have to display intervals like '2 seconds' ago and very often browser time is different from server time in couple of seconds. With this patch I can specify current time as server time and display correct intervals.
Interesting. May I ask why you need such accurate intervals? Also, could you also supply the code that you would use to sync with the server time? Are you keeping a server timestamp from the time the page was rendered and then tracking against that? I'm interested, because if I add this feature, it might be nice to give an example as to why it was added.
I have to display very frequently updated data - usually in interval from ten seconds to ten minutes (very rarely can be couple of hours), and one minute interval is too big. I added easily custom formating by replacing settings.strings.seconds, but with 'current time' I've got problem.
Here is how I've implemented it - http://gist.github.com/398928
I too have a similar concern. My server is in California but many of my users are on the East coast so when you insert a record into the database the timestamp is that of the server time (3 hours prior to current East coast time). This results in timeago always stating that a freshly inserted record was added "about 3 hours ago" instead of "less than a minute".
If there is a simple timezone fix that I'm missing please let me know. Otherwise perhaps this is something that needs to be addressed.
forrestfrazier, Timeago timestamps are required to be in ISO8601 format, which includes a time zone. If you use the correct timestamp format, timeago should automatically work in all time zones. This reported ticket covers something different.
For more information, see Time zone designators for ISO8601
rmm5t, Thanks for calling that out. Since my datetime field doesn't have the timezone I had to play around with this a bit. Converted my timestamp to unix time, added the difference from my servers timezone to Zulu then output that in ISO8601
$unixtime = strtotime($dateTimeFromDatabase);
$ztime = $unixtime +420 * 60;
$guest_time = strftime("%Y-%m-%dT%H:%M:%SZ" , $ztime);
Thanks again for the timeago, I love it.
I don't know if anything ever happened with this request, but it's something I'd like to see as well.... It's not a huge deal, but our test server often has incorrect time (the ntp port is blocked, so we can't update it automoatically). And I often get things like "8 minutes ago" for things that just happened (should be "a few seconds ago"). If users computer time is a few minute off, this could cause confusion as well, so it would be nice to be able to say "current time is X" when the page loads and all calculations are based on that instead.
+1, I was just about to create a similar request.
This could be useful on a per-element basis as well. For instance, we have some elements that are representations of durations (within a known context) which we have to calculate server-side. But, if we could send the start and end time along to the client, timeago could do that calculation in the browser.
<time class="timeago" from="2013-03-22T10:25:56Z" datetime="2013-03-22T14:25:56Z" >past 4 hours</time>
$.timeago.settings.strings. prefixAgo = "past"
$.timeago.settings.strings. suffixAgo = null
That would be great. Otherwise people with wrong time see wrong results.
Why is it still open?
I meant "unresolved" by "open" :(