@formio/js 5.0.0-dev.5755.7a395f8 → 5.0.0-dev.5760.4aea057
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,7 +30,8 @@ class DayComponent extends Field_1.default {
|
|
|
30
30
|
required: false
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
dayFirst: false
|
|
33
|
+
dayFirst: false,
|
|
34
|
+
defaultValue: ''
|
|
34
35
|
}, ...extend);
|
|
35
36
|
}
|
|
36
37
|
static get builderInfo() {
|
|
@@ -343,15 +344,21 @@ class DayComponent extends Field_1.default {
|
|
|
343
344
|
const valueParts = value.split('/');
|
|
344
345
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
345
346
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
|
346
|
-
const getNextPart = (shouldTake, defaultValue) =>
|
|
347
|
+
const getNextPart = (shouldTake, defaultValue) => {
|
|
348
|
+
// Only push the part if it's not an empty string
|
|
349
|
+
const part = shouldTake ? valueParts.shift() : defaultValue;
|
|
350
|
+
if (part !== '') {
|
|
351
|
+
dateParts.push(part);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
347
354
|
if (this.dayFirst) {
|
|
348
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
355
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
349
356
|
}
|
|
350
|
-
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '
|
|
357
|
+
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
|
|
351
358
|
if (!this.dayFirst) {
|
|
352
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
359
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
353
360
|
}
|
|
354
|
-
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '
|
|
361
|
+
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
|
|
355
362
|
return dateParts.join('/');
|
|
356
363
|
}
|
|
357
364
|
/**
|
|
@@ -558,7 +565,13 @@ class DayComponent extends Field_1.default {
|
|
|
558
565
|
}
|
|
559
566
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
560
567
|
const values = value.split('/');
|
|
561
|
-
return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
568
|
+
// return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
569
|
+
return (values[DAY] === '00' ||
|
|
570
|
+
values[MONTH] === '00' ||
|
|
571
|
+
values[YEAR] === '0000' ||
|
|
572
|
+
values[DAY] === '' ||
|
|
573
|
+
values[MONTH] === '' ||
|
|
574
|
+
values[YEAR] === '');
|
|
562
575
|
}
|
|
563
576
|
getValidationFormat() {
|
|
564
577
|
return this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
|
|
@@ -25,7 +25,8 @@ export default class DayComponent extends Field {
|
|
|
25
25
|
required: false
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
dayFirst: false
|
|
28
|
+
dayFirst: false,
|
|
29
|
+
defaultValue: ''
|
|
29
30
|
}, ...extend);
|
|
30
31
|
}
|
|
31
32
|
static get builderInfo() {
|
|
@@ -341,15 +342,21 @@ export default class DayComponent extends Field {
|
|
|
341
342
|
const valueParts = value.split('/');
|
|
342
343
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
343
344
|
const defaultValue = this.component.defaultValue ? this.component.defaultValue.split('/') : '';
|
|
344
|
-
const getNextPart = (shouldTake, defaultValue) =>
|
|
345
|
+
const getNextPart = (shouldTake, defaultValue) => {
|
|
346
|
+
// Only push the part if it's not an empty string
|
|
347
|
+
const part = shouldTake ? valueParts.shift() : defaultValue;
|
|
348
|
+
if (part !== '') {
|
|
349
|
+
dateParts.push(part);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
345
352
|
if (this.dayFirst) {
|
|
346
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
353
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
347
354
|
}
|
|
348
|
-
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '
|
|
355
|
+
getNextPart(this.showMonth, defaultValue ? defaultValue[MONTH] : '');
|
|
349
356
|
if (!this.dayFirst) {
|
|
350
|
-
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '
|
|
357
|
+
getNextPart(this.showDay, defaultValue ? defaultValue[DAY] : '');
|
|
351
358
|
}
|
|
352
|
-
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '
|
|
359
|
+
getNextPart(this.showYear, defaultValue ? defaultValue[YEAR] : '');
|
|
353
360
|
return dateParts.join('/');
|
|
354
361
|
}
|
|
355
362
|
/**
|
|
@@ -554,7 +561,13 @@ export default class DayComponent extends Field {
|
|
|
554
561
|
}
|
|
555
562
|
const [DAY, MONTH, YEAR] = this.component.dayFirst ? [0, 1, 2] : [1, 0, 2];
|
|
556
563
|
const values = value.split('/');
|
|
557
|
-
return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
564
|
+
// return (values[DAY] === '00' || values[MONTH] === '00' || values[YEAR] === '0000');
|
|
565
|
+
return (values[DAY] === '00' ||
|
|
566
|
+
values[MONTH] === '00' ||
|
|
567
|
+
values[YEAR] === '0000' ||
|
|
568
|
+
values[DAY] === '' ||
|
|
569
|
+
values[MONTH] === '' ||
|
|
570
|
+
values[YEAR] === '');
|
|
558
571
|
}
|
|
559
572
|
getValidationFormat() {
|
|
560
573
|
return this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.5760.4aea057",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -56,10 +56,9 @@
|
|
|
56
56
|
"dopublish": "npm run build && npm run tag && npm publish",
|
|
57
57
|
"lint": "eslint ./src --fix",
|
|
58
58
|
"serve": "jekyll serve --config _config.yml,_config.dev.yml",
|
|
59
|
-
"test": "
|
|
59
|
+
"test": "mocha 'src/**/*.unit.js'",
|
|
60
60
|
"test:updateRenders": "npm run lib && TZ=UTC node --require jsdom-global/register test/updateRenders.js",
|
|
61
|
-
"test:e2e": "NODE_OPTIONS=\"--max-old-space-size=4096\" karma start --verbose --single-run"
|
|
62
|
-
"show-coverage": "open coverage/lcov-report/index.html"
|
|
61
|
+
"test:e2e": "NODE_OPTIONS=\"--max-old-space-size=4096\" karma start --verbose --single-run"
|
|
63
62
|
},
|
|
64
63
|
"repository": {
|
|
65
64
|
"type": "git",
|
|
@@ -156,7 +155,6 @@
|
|
|
156
155
|
"mocha": "^10.3.0",
|
|
157
156
|
"mock-local-storage": "^1.1.24",
|
|
158
157
|
"natives": "^1.1.6",
|
|
159
|
-
"nyc": "^17.0.0",
|
|
160
158
|
"power-assert": "^1.6.1",
|
|
161
159
|
"pre-commit": "^1.2.2",
|
|
162
160
|
"pretty": "^2.0.0",
|
|
@@ -176,19 +174,5 @@
|
|
|
176
174
|
"webpack-cli": "^5.1.1",
|
|
177
175
|
"webpack-node-externals": "^3.0.0",
|
|
178
176
|
"webpack-stream": "^7.0.0"
|
|
179
|
-
},
|
|
180
|
-
"nyc": {
|
|
181
|
-
"check-coverage": true,
|
|
182
|
-
"statements": 15,
|
|
183
|
-
"branches": 18,
|
|
184
|
-
"functions": 14,
|
|
185
|
-
"lines": 15,
|
|
186
|
-
"include": [
|
|
187
|
-
"src/**/*.js"
|
|
188
|
-
],
|
|
189
|
-
"exclude": [
|
|
190
|
-
"src/**/fixtures"
|
|
191
|
-
],
|
|
192
|
-
"all": true
|
|
193
177
|
}
|
|
194
178
|
}
|