1

I am using the following javascript to convert UTC times into the users local timezone...

(function() {
  (function($) {
    return $.fn.localtime = function() {
      var fmtDate, fmtZero;
      fmtZero = function(str) {
        return ('0' + str).slice(-2);
      };
      fmtDate = function(d) {
        var hour, meridiem;
        hour = d.getHours();
        if (hour < 12) {
          meridiem = "AM";
        } else {
          meridiem = "PM";
        }
        if (hour === 0) { hour = 12; }
        if (hour > 12) { hour = hour - 12; }
        return hour + ":" + fmtZero(d.getMinutes()) + " " + meridiem + " " 
      };
      return this.each(function() {
        var tagText;
        tagText = $(this).html();
        $(this).html(fmtDate(new Date(tagText)));
        return $(this).attr("title", tagText);
      });
    };
  })(jQuery);
    }).call(this);

This all works fine in every browser apart from Internet Explorer, instead of converting the time it just displays 'NaN'

Can anyone see why this is happening?

gariepy
  • 3,576
  • 6
  • 21
  • 34
fightstarr20
  • 11,682
  • 40
  • 154
  • 278

0 Answers0