2

我正在使用 jQuery timeago 插件,它可以在 Chrome 和 Firefox 中运行,但不能在 Safari 中运行。正如网站上给出的那样,用法非常简单。

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

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

标签中的标题和日期<abbr>是 iso 时间戳。它在 Chrome 和 Firefox 中按预期工作,但只是在 Safari 中打印出时间戳(例如 2012-11-28 19:16:49)。

任何人都可以帮我解决问题所在吗?

在 Chrome 中 编辑:在此处输入图像描述

在 Safari 中: 在此处输入图像描述

4

1 回答 1

0

for utc string created from: newDate.toUTCString():

in Google Chrome browser, calling jQuery.timeago('Fri, 31 May 2013 10:37:16 GMT') produce output 'NaN years ago'. However, it is working fine in Firefox browse.

The best is to use newDate.toISOString() and it works in both browser.

于 2013-06-01T07:46:14.630 回答