en.javascript.info/1-js/7-js-misc/1-class-instanceof/1-format-date-polymorphic/_js.view/test.js
2015-03-22 00:36:11 +03:00

18 lines
No EOL
642 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe("formatDate", function() {
it("читает дату вида гггг-мм-дд из строки", function() {
assert.equal(formatDate('2011-10-02'), "02.10.11");
});
it("читает дату из числа 1234567890 (миллисекунды)", function() {
assert.equal(formatDate(1234567890), "14.02.09");
});
it("читает дату из массива вида [гггг, м, д]", function() {
assert.equal(formatDate([2014, 0, 1]), "01.01.14");
});
it("читает дату из объекта Date", function() {
assert.equal(formatDate(new Date(2014, 0, 1)), "01.01.14");
});
});