javascript - Date.toString() not converting hours to proper timezone in Firefox -


i have html rendered django template formats timestamp in iso 8601 format, e.g:

<span class="my-date">2015-06-04t13:00:00</span> 

i using javascript convert timestamp user's local timezone:

$(document).ready(function(){   $('.my-date').each( function(){     var tz_date = new date( $(this).text() );     $(this).text( tz_date.tostring() );   }); }); 

this works fine in chrome (e.g, results in thu jun 04 2015 09:00:00 gmt-0400 (edt)), i'm having issue in firefox, showing thu jun 04 2015 13:00:00 gmt-0400 (edt). seems firefox correctly appending user's timezone, not adjusting hours.

i wanted check here if there's poor assumption i'm making in code, or if bug in firefox.

jsfiddle

rather use iso 8601 timestamps, can use rfc 2822 timestamps. both django , javascript's date.parse() compatible this, , both chrome's , firefox's implementation work same way it.

the change needs made in django template renders timestamp server side. rather use |date:'c', use |date:'r'.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -