mattbradley / livestampjs

A simple, unobtrusive jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements using Moment.js.
http://mattbradley.github.com/livestampjs
MIT License
409 stars 70 forks source link

Sets the "From" date to compare with (instead of the current time) #40

Closed bouiboui closed 6 years ago

bouiboui commented 9 years ago

This is a quick and dirty solution to the issue #39.

It takes the global (ugghh... I know) unix timestamp $.livestampTimeFrom and shifts the date accordingly. A basic implementation in PHP would be:

<script type="text/javascript">
$.livestampTimeFrom = <?=time()?>;
</script>

This is far from ideal as I haven't found an elegant solution to add a local parameter to livestamp, but it seems to work.

bouiboui commented 9 years ago

Several tests later on different servers, 12333e5 seems to be the best solution to yield correct results.