Sunday, 15 August 2010

jQuery CuteTime Plugin and Ajax Data - False conversion in IE + Safari? -



jQuery CuteTime Plugin and Ajax Data - False conversion in IE + Safari? -

i have site liveticker loads new forum events , adds them html table.

for time field ajax-loading datetime of each event (e.g. 2013-02-15 17:28:03), , converting them via jquery plugin cutetime human readable format, e.g. 22 minutes ago.

problem cutetime recent version (from 2010) has issues in dealing dynamically loaded ajax data.

my current solution seems work bit:

1.at first ajax phone call loads entire forum events html table, assign cutetime plugin:

// initial load @ page startup $('#responsecontainer').load('./liveticker', {ajax:1}, function() { // convert datetime readable date format $('.timestamp').cutetime(); });

2.then check every 30 seconds new events, , assign cutetime each time on loaded data:

$('#responseevents').load('./liveticker', {ajax:lastevent}, function() { // stuff... // convert datetime readable date format $('.timestamp').cutetime(); })

this seems work in firefox , chrome. however, in net explorer 9 $(.timestamp) elements same text assigned: just now.

does know solution bug / problem?

--

note: on cutetime-site found comment ajax. there stated workaround:

i had hack app create additional fields first re-create values spans, phone call cutetime.

but not sure if in way connected net explorer bug facing now...

it not ajax call. indeed, used normal datetime format (from mysql) , tried convert format cutetime.

reading site of developer, stumbled on sentence:

timestamp must valid date().parse 'able' format

as as:

if neither cutetime attribute nor valid object text exist, timestamp assumed ‘now’.

bingo! formattting datetime iso8601 date format server site with:

$timecode = date("c", strtotime( $row['datetime'] ));

and dates in format: 2013-02-17t15:26:21+01:00 work js-conversion in browsers!

jquery plugins time

No comments:

Post a Comment