Commit 2bac7b8a authored by Marco Mariani's avatar Marco Mariani

added JIODate.prototype.toString()

parent ecee078b
......@@ -72,6 +72,7 @@
}
this.mom = null;
this._str = str;
// http://www.w3.org/TR/NOTE-datetime
// http://dotat.at/tmp/ISO_8601-2004_E.pdf
......@@ -155,6 +156,11 @@
};
JIODate.prototype.toString = function () {
return this._str;
};
_export('JIODate', JIODate);
_export('YEAR', YEAR);
......
......@@ -170,6 +170,18 @@
});
test("The toString() method should retain the precision", function () {
var d;
d = JIODate('2012-05-08');
strictEqual(d.toString(), '2012-05-08');
d = JIODate('2012-05');
strictEqual(d.toString(), '2012-05');
d = JIODate('2012');
strictEqual(d.toString(), '2012');
});
test("Parsing of partial timestamp values with any precision", function () {
var d;
......@@ -207,7 +219,6 @@
strictEqual(d.getPrecision(), 'year');
strictEqual(d.toPrecisionString(), '2012');
strictEqual(d.mom.toISOString(), '2012-01-01T00:00:00.000Z');
});
......@@ -272,7 +283,6 @@
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:07')), +1);
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:08')), 0);
strictEqual(dmsec.cmp(JIODate('2012-05-02 06:07:09')), -1);
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment