mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2024-11-30 11:06:55 -05:00
Merge pull request #84 from arnaud-lb/pr0
fixed parsing of timestamps with decimal fraction of a second
This commit is contained in:
commit
1816b7428a
2 changed files with 6 additions and 1 deletions
|
@ -91,7 +91,7 @@
|
||||||
},
|
},
|
||||||
parse: function(iso8601) {
|
parse: function(iso8601) {
|
||||||
var s = $.trim(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(/-/,"/").replace(/-/,"/");
|
||||||
s = s.replace(/T/," ").replace(/Z/," UTC");
|
s = s.replace(/T/," ").replace(/Z/," UTC");
|
||||||
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
|
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
<li><abbr id="testParsing7" class="todate" title="1978-12-18 17:17:00"></abbr> [from blank TZ]</li>
|
<li><abbr id="testParsing7" class="todate" title="1978-12-18 17:17:00"></abbr> [from blank TZ]</li>
|
||||||
<li><abbr id="testParsing8" class="todate" title="1978-12-18 17:17:00.021Z"></abbr> [from Z with milliseonds]</li>
|
<li><abbr id="testParsing8" class="todate" title="1978-12-18 17:17:00.021Z"></abbr> [from Z with milliseonds]</li>
|
||||||
<li><abbr id="testParsing9" class="todate" title="1978-12-18 17:17:00.021432Z"></abbr> [from Z with microseonds]</li>
|
<li><abbr id="testParsing9" class="todate" title="1978-12-18 17:17:00.021432Z"></abbr> [from Z with microseonds]</li>
|
||||||
|
<li><abbr id="testParsing10" class="todate" title="1978-12-18 17:17:00.0Z"></abbr> [from Z with milliseonds]</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Wording</h2>
|
<h2>Wording</h2>
|
||||||
|
@ -354,6 +355,10 @@
|
||||||
ok(($("#testParsing9").html().match(correctMatch)), "Correctly parsed");
|
ok(($("#testParsing9").html().match(correctMatch)), "Correctly parsed");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("From Z with microseconds", function () {
|
||||||
|
ok(($("#testParsing10").html().match(correctMatch)), "Correctly parsed");
|
||||||
|
});
|
||||||
|
|
||||||
module("Wording");
|
module("Wording");
|
||||||
|
|
||||||
test("-120 min", function () {
|
test("-120 min", function () {
|
||||||
|
|
Loading…
Reference in a new issue