in Ox.parseDate, only remove first element of values array if there was a match

This commit is contained in:
rlx 2012-06-10 09:21:07 +00:00
parent 4625b4ac36
commit 92bfb38caf

View file

@ -279,8 +279,9 @@ Ox.parseDate = function(string, utc) {
var date, var date,
defaults = [, 1, 1, 0, 0, 0, 0], defaults = [, 1, 1, 0, 0, 0, 0],
values = /(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?\.?(\d+)?/ values = /(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?\.?(\d+)?/
.exec(string).slice(1); .exec(string);
if (values) { if (values) {
values.shift();
date = new Date(); date = new Date();
values = values.map(function(v, i) { values = values.map(function(v, i) {
return v ? (i == 6 ? Ox.pad(v, 3, '0') : v) : defaults[i]; return v ? (i == 6 ? Ox.pad(v, 3, '0') : v) : defaults[i];