简体   繁体   English

jQuery timeago插件无法在Safari中使用

[英]jQuery timeago plugin not working in Safari

I am using jQuery timeago plugin, and it is working in Chrome and Firefox but not in Safari. 我正在使用jQuery timeago插件,它在Chrome和Firefox中有效,但在Safari中不起作用。 The usage is pretty simple as given on the website. 用法很简单,如网站上所给。

 $(document).ready(function() {
      jQuery("abbr.timeago").timeago();
    });

<abbr class="timeago" title="{{ISO8601_TIME timeStamp}}">{{COMMENT_DATE_TIME timeStamp}}</abbr>

The title and the date in the <abbr> tags is the iso timestamp. <abbr>标记中的标题和日期是iso时间戳。 It works as expected in Chrome and Firefox but simply prints out the timestamp in Safari (eg 2012-11-28 19:16:49). 它可以在Chrome和Firefox中按预期工作,但只是在Safari中打印出时间戳(例如2012-11-28 19:16:49)。

Can anyone please help me out where the problem is? 谁能帮我解决问题所在?

EDIT In Chrome: 在Chrome中编辑 在此处输入图片说明

In Safari: 在Safari中: 在此处输入图片说明

for utc string created from: newDate.toUTCString(): 对于从以下位置创建的utc字符串:newDate.toUTCString():

in Google Chrome browser, calling jQuery.timeago('Fri, 31 May 2013 10:37:16 GMT') produce output 'NaN years ago'. 在Google Chrome浏览器中,调用jQuery.timeago('Fri,31 May 2013 10:37:16 GMT')产生的输出为“ NaN years ago”。 However, it is working fine in Firefox browse. 但是,它在Firefox浏览器中工作正常。

The best is to use newDate.toISOString() and it works in both browser. 最好是使用newDate.toISOString(),它在两种浏览器中都可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM