Skip to content
This repository
Browse code

Merge pull request #84 from arnaud-lb/pr0

fixed parsing of timestamps with decimal fraction of a second
  • Loading branch information...
commit 1816b7428a890c515490dbd65e61e51752150ea0 2 parents 6f616b5 + 8083799
Ryan McGeary authored

Showing 2 changed files with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  jquery.timeago.js
  2. +5 0 test/index.html
2  jquery.timeago.js
@@ -91,7 +91,7 @@
91 91 },
92 92 parse: function(iso8601) {
93 93 var s = $.trim(iso8601);
94   - s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
  94 + s = s.replace(/\.\d+/,""); // remove milliseconds
95 95 s = s.replace(/-/,"/").replace(/-/,"/");
96 96 s = s.replace(/T/," ").replace(/Z/," UTC");
97 97 s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
5 test/index.html
@@ -95,6 +95,7 @@ <h2 id="qunit-userAgent"></h2>
95 95 <li><abbr id="testParsing7" class="todate" title="1978-12-18 17:17:00"></abbr> [from blank TZ]</li>
96 96 <li><abbr id="testParsing8" class="todate" title="1978-12-18 17:17:00.021Z"></abbr> [from Z with milliseonds]</li>
97 97 <li><abbr id="testParsing9" class="todate" title="1978-12-18 17:17:00.021432Z"></abbr> [from Z with microseonds]</li>
  98 + <li><abbr id="testParsing10" class="todate" title="1978-12-18 17:17:00.0Z"></abbr> [from Z with milliseonds]</li>
98 99 </ul>
99 100
100 101 <h2>Wording</h2>
@@ -354,6 +355,10 @@ <h2 id="qunit-userAgent"></h2>
354 355 ok(($("#testParsing9").html().match(correctMatch)), "Correctly parsed");
355 356 });
356 357
  358 + test("From Z with microseconds", function () {
  359 + ok(($("#testParsing10").html().match(correctMatch)), "Correctly parsed");
  360 + });
  361 +
357 362 module("Wording");
358 363
359 364 test("-120 min", function () {

0 comments on commit 1816b74

Please sign in to comment.
Something went wrong with that request. Please try again.