Update frontend date validation and format

This commit is contained in:
Antonin Delpeuch 2019-02-19 22:46:33 +00:00
parent b157651e9e
commit 6d820dfea5
2 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -77,8 +77,8 @@ public class WbDateConstantTest extends WbExpressionTest<TimeValue> {
new WbDateConstant("invalid format");
}
@Test
@Test(expectedExceptions = IllegalArgumentException.class)
public void testPartlyValid() {
isSkipped(new WbDateConstant("2018-partly valid"));
new WbDateConstant("2018-partly valid");
}
}