From 6d820dfea507604b9ce208756cd9ee9122e5b762 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Tue, 19 Feb 2019 22:46:33 +0000 Subject: [PATCH] Update frontend date validation and format --- .../module/scripts/dialogs/schema-alignment-dialog.js | 4 ++-- .../org/openrefine/wikidata/schema/WbDateConstantTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js index f9a1ebc8b..66f995dd5 100644 --- a/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js +++ b/extensions/wikidata/module/scripts/dialogs/schema-alignment-dialog.js @@ -834,7 +834,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue, fixSuggestInput(input); } else if (mode === "time") { - input.attr("placeholder", "YYYY(-MM(-DD))..."); + input.attr("placeholder", "YYYY(-MM(-DD))"); var propagateValue = function(val) { // TODO add validation here inputContainer.data("jsonValue", { @@ -848,7 +848,7 @@ SchemaAlignmentDialog._initField = function(inputContainer, mode, initialValue, changedCallback(); }); - SchemaAlignmentDialog.setupStringInputValidation(input, /^\d{4}(-[0-1]\d(-[0-3]\d(T[0-2]\d(:[0-5]\d(:[0-5]\dZ)?)?)?)?)?$/); + SchemaAlignmentDialog.setupStringInputValidation(input, /^\d{4}(-[0-1]\d(-[0-3]\d)?)?$/); } else if (mode === "globe-coordinate") { input.attr("placeholder", "lat,lon"); var propagateValue = function(val) { diff --git a/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbDateConstantTest.java b/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbDateConstantTest.java index d65d3e55a..d7d777034 100644 --- a/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbDateConstantTest.java +++ b/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbDateConstantTest.java @@ -77,8 +77,8 @@ public class WbDateConstantTest extends WbExpressionTest { new WbDateConstant("invalid format"); } - @Test + @Test(expectedExceptions = IllegalArgumentException.class) public void testPartlyValid() { - isSkipped(new WbDateConstant("2018-partly valid")); + new WbDateConstant("2018-partly valid"); } }