Skip to content

Commit

Permalink
fix #130
Browse files Browse the repository at this point in the history
  • Loading branch information
lkho authored Feb 27, 2017
1 parent 147ecc0 commit 01ff885
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/fields/core/fieldInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,28 @@
mixins: [ abstractField ],
methods: {
formatValueToField(value) {
if (typeof value === "undefined") {
return value;
} else {
if (value != null) {
switch(this.schema.inputType){
case "date":
return fecha.format(value, "YYYY-MM-DD");
case "datetime":
return fecha.format(value, "YYYY-MM-DD HH:mm:ss");
case "datetime-local":
return fecha.format(value, "YYYY-MM-DDTHH:mm:ss");
default:
return value;
}
}
return value;
},
formatValueToModel(value) {
if (value != null) {
if (this.schema.inputType === "date" ||
this.schema.inputType === "datetime" ||
this.schema.inputType === "datetimelocal") {
return new Date(value).getTime();
switch (this.schema.inputType){
case "date":
return fecha.parse(value, "YYYY-MM-DD");
case "datetime":
return fecha.parse(value, "YYYY-MM-DD HH:mm:ss");
case "datetime-local":
return fecha.parse(value, "YYYY-MM-DDTHH:mm:ss");
}
}
Expand Down

0 comments on commit 01ff885

Please sign in to comment.