Added support for 2-digit time zone designators

Fixes #156
This commit is contained in:
Ryan McGeary 2013-12-26 12:54:51 -05:00
parent 54a466d81b
commit ef0ffa0df0
2 changed files with 7 additions and 0 deletions

View file

@ -107,6 +107,7 @@
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900
return new Date(s);
},
datetime: function(elem) {

View file

@ -90,6 +90,7 @@
<li><abbr id="testParsing9" class="todate" title="1978-12-18 17:17:00.021432Z"></abbr> [from Z with microseconds]</li>
<li><abbr id="testParsing10" class="todate" title="1978-12-18 17:17:00.0Z"></abbr> [from Z with tenths of a second]</li>
<li><abbr id="testParsing11" class="todate" title="1978-12-18 17:17:00.02Z"></abbr> [from Z with hundreths of a second]</li>
<li><abbr id="testParsing12" class="todate" title="1978-12-19T02:17:00+09"></abbr> [from +09]</li>
</ul>
<h2>Wording</h2>
@ -400,6 +401,11 @@
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
test("From +09", function () {
var time = $("#testParsing12");
ok((time.html().match(correctMatch)), "Incorrectly parsed " + time.attr("title"));
});
module("Wording");
test("-120 min", function () {