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