From: Sven Schöling Date: Thu, 26 Oct 2017 13:00:16 +0000 (+0200) Subject: kivi.js: Und den wirren "00" Sonderfall auch wiederhergestellt X-Git-Tag: release-3.5.4~669 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=25b6e6a881fe0faf7f85b81c6eb6ee25a835b542;p=kivitendo-erp.git kivi.js: Und den wirren "00" Sonderfall auch wiederhergestellt --- diff --git a/js/kivi.js b/js/kivi.js index 97089645c..3ee73a708 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -37,7 +37,7 @@ namespace("kivi", function(ns) { if (date === '') return null; - if (date === '0') + if (date === '0' || date === '00') return new Date(); var parts = date.replace(/\s+/g, "").split(ns._date_format.sep); diff --git a/js/t/kivi/parse_format_date.js b/js/t/kivi/parse_format_date.js index 7fe32e69c..121d43e62 100644 --- a/js/t/kivi/parse_format_date.js +++ b/js/t/kivi/parse_format_date.js @@ -35,6 +35,7 @@ QUnit.test("kivi.parse_date function for German date style with dots", function( assert.deepEqual(kivi.parse_date(".."), today()); assert.deepEqual(kivi.parse_date(""), null); assert.deepEqual(kivi.parse_date("0"), new Date()); + assert.deepEqual(kivi.parse_date("00"), new Date()); assert.deepEqual(kivi.parse_date("29.02.20008"), undefined); }); @@ -136,6 +137,9 @@ QUnit.test("kivi.format_date function for ISO date style", function( assert ) { assert.deepEqual(kivi.parse_date("1"), new Date((new Date).getFullYear(), (new Date).getMonth(), 1)); assert.deepEqual(kivi.parse_date("01"), new Date((new Date).getFullYear(), (new Date).getMonth(), 1)); + assert.deepEqual(kivi.parse_date("0"), new Date()); + assert.deepEqual(kivi.parse_date("00"), new Date()); + assert.deepEqual(kivi.parse_date("-"), today()); assert.deepEqual(kivi.parse_date("--"), today());