You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything works as it should until I implement the listener.
$('#Timestamp').on('change.livestamp', function(event, from, to) {
event.preventDefault(); // Stop the text from changing automatically
console.log(from,to);
if(to.indexOf("ago")){
$(this).removeClass("label-success label-warning").addClass("label-danger").html(to);
} else {
$(this).html(to);
}
}).livestamp();
It goes from saying 3 hours ago to saying a few seconds ago on load. Like it's just using the current time instead of the data attribute time provided.
The text was updated successfully, but these errors were encountered:
So I did some step through debug. It seems it runs through once and does it's thing ok, then it runs through a 2nd time, assuming cause of the listener, and since data-livestamp no longer exists since it is removed on line 16, it defaults to the current time.
Everything works as it should until I implement the listener.
It goes from saying
3 hours ago
to sayinga few seconds ago
on load. Like it's just using the current time instead of the data attribute time provided.The text was updated successfully, but these errors were encountered: