Skip to content

Commit

Permalink
Merge pull request #133 from lkho/patch-1
Browse files Browse the repository at this point in the history
fix #130
  • Loading branch information
icebob authored Feb 27, 2017
2 parents 147ecc0 + 01ff885 commit 6158a51
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 6158a51

Please sign in to comment.