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

display and update dynamically created <span data-livestamp=''> element #27

Closed dongliu closed 10 years ago

dongliu commented 10 years ago

On a page, elements are dynamically created and appended to the dom. They are not properly displayed or updated. I tried to call $.livestamp.update() or $.livestamp.resume() right after the dom operation, and it did not work.

mattbradley commented 10 years ago

I'm having trouble reproducing this bug. Can you make an example on http://jsfiddle.net?

dongliu commented 10 years ago

I double checked the code, and found the problem was because the time string format. I read through the document and found only seconds or ISO 8601 are allowed within data-livestamp. After formatting the time string with moment, livestamp works as expected. In fact, I think any format accepted by moment should work after I go through the source code.