File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 43
43
mixins: [ abstractField ],
44
44
methods: {
45
45
formatValueToField (value ) {
46
- if (typeof value === " undefined" ) {
47
- return value;
48
- } else {
46
+ if (value != null ) {
49
47
switch (this .schema .inputType ){
50
48
case " date" :
51
49
return fecha .format (value, " YYYY-MM-DD" );
52
50
case " datetime" :
53
51
return fecha .format (value, " YYYY-MM-DD HH:mm:ss" );
54
52
case " datetime-local" :
55
53
return fecha .format (value, " YYYY-MM-DDTHH:mm:ss" );
56
- default :
57
- return value;
58
54
}
59
55
}
56
+
57
+ return value;
60
58
},
61
59
formatValueToModel (value ) {
62
60
if (value != null ) {
63
- if (this .schema .inputType === " date" ||
64
- this .schema .inputType === " datetime" ||
65
- this .schema .inputType === " datetimelocal" ) {
66
- return new Date (value).getTime ();
61
+ switch (this .schema .inputType ){
62
+ case " date" :
63
+ return fecha .parse (value, " YYYY-MM-DD" );
64
+ case " datetime" :
65
+ return fecha .parse (value, " YYYY-MM-DD HH:mm:ss" );
66
+ case " datetime-local" :
67
+ return fecha .parse (value, " YYYY-MM-DDTHH:mm:ss" );
67
68
}
68
69
}
69
70
You can’t perform that action at this time.
0 commit comments