Skip to content

Commit 97213a8

Browse files
committed
handle null value
1 parent dcaa273 commit 97213a8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/fields/fieldInput.vue

+11-9
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@
4343
mixins: [ abstractField ],
4444
methods: {
4545
formatValueToField(value) {
46-
switch(this.schema.inputType){
47-
case "date":
48-
return fecha.format(value, "YYYY-MM-DD");
49-
case "datetime":
50-
return fecha.format(value);
51-
case "datetime-local":
52-
return fecha.format(value, "YYYY-MM-DDTHH:mm:ss");
53-
default:
54-
return value;
46+
if (value != null) {
47+
switch(this.schema.inputType){
48+
case "date":
49+
return fecha.format(value, "YYYY-MM-DD");
50+
case "datetime":
51+
return fecha.format(value);
52+
case "datetime-local":
53+
return fecha.format(value, "YYYY-MM-DDTHH:mm:ss");
54+
default:
55+
return value;
56+
}
5557
}
5658
},
5759
formatValueToModel(value) {

0 commit comments

Comments
 (0)