From 8083799acde79730037a0f8cc2caaee9a8ebdb36 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Thu, 28 Jun 2012 23:16:31 +0200 Subject: [PATCH] fixed parsing of timestamps with decimal fraction of a second --- jquery.timeago.js | 2 +- test/index.html | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jquery.timeago.js b/jquery.timeago.js index 1417747..3ba59e4 100644 --- a/jquery.timeago.js +++ b/jquery.timeago.js @@ -91,7 +91,7 @@ }, parse: function(iso8601) { var s = $.trim(iso8601); - s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/\.\d+/,""); // remove milliseconds s = s.replace(/-/,"/").replace(/-/,"/"); s = s.replace(/T/," ").replace(/Z/," UTC"); s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 diff --git a/test/index.html b/test/index.html index a215d1c..b36071b 100644 --- a/test/index.html +++ b/test/index.html @@ -95,6 +95,7 @@
  • [from blank TZ]
  • [from Z with milliseonds]
  • [from Z with microseonds]
  • +
  • [from Z with milliseonds]
  • Wording

    @@ -354,6 +355,10 @@ ok(($("#testParsing9").html().match(correctMatch)), "Correctly parsed"); }); + test("From Z with microseconds", function () { + ok(($("#testParsing10").html().match(correctMatch)), "Correctly parsed"); + }); + module("Wording"); test("-120 min", function () {