This commit is contained in:
2019-03-06 00:52:22 +00:00
parent 02d8508763
commit d922b90908
3 changed files with 33 additions and 23 deletions

View File

@@ -73,8 +73,8 @@ export default {
formats: { formats: {
decimalSeparator: ".", decimalSeparator: ".",
currencySymbol: "$", currencySymbol: "$",
shortDateFormat: "YYYY-MM-DD", shortDate: "YYYY-MM-DD",
shortTimeFormat: "hh:mm:ss A", shortTime: "hh:mm:ss A",
shortDateAndTimeFormat: "YYYY-MM-DD hh:mm:ss A" shortDateAndTime: "YYYY-MM-DD hh:mm:ss A"
} }
}; };

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<v-layout row wrap> <v-layout row wrap v-if="!readonly">
<v-flex xs6> <v-flex xs6>
<v-dialog v-model="modal" persistent lazy full-width width="290px"> <v-dialog v-model="modal" persistent lazy full-width width="290px">
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
@@ -30,15 +30,17 @@
</v-dialog> </v-dialog>
</v-flex> </v-flex>
</v-layout> </v-layout>
<!-- <v-text-field <v-text-field
v-else v-if="readonly"
v-model="formatDateTime" v-model="formatDateTime"
v-bind:label="label" v-bind:label="label"
prepend-icon="fa-calendar-alt" prepend-icon="fa-calendar-alt"
disabled disabled
></v-text-field>--> ></v-text-field>
</div> </div>
</template> <script> </template>
<script>
/* eslint-disable */
export default { export default {
data: () => ({ date: null, modal: false, modal2: false }), data: () => ({ date: null, modal: false, modal2: false }),
props: { props: {
@@ -58,15 +60,29 @@ export default {
}, },
computed: { computed: {
formatDateTime() { formatDateTime() {
//console.log("FORMAT DATE TIME");
//debugger;
return this.value return this.value
? this.dayjs(this.value).format(this.locale.shortDateAndTimeFormat) ? this.dayjs(this.value).format(this.locale.formats.shortDateAndTime)
: ""; : "";
}, },
formatDate() { formatDate() {
return this.value return this.value
? this.dayjs(this.value).format(this.locale.shortTimeFormat) ? this.dayjs(this.value).format(this.locale.formats.shortDate)
: ""; : "";
}, },
formatTime() {
return this.value
? this.dayjs(this.value).format(this.locale.formats.shortTime)
: "";
//Note in original code this would be parsed expecting source value to be in UTC format coming in but display in local time format
//so
// let momentObj = this.$moment.utc();
// if (this.value) {
// momentObj = this.$moment.utc(this.value);
// }
// return momentObj.local().format("h:mm a");
},
dateOnly: { dateOnly: {
get() { get() {
return this.value ? this.value.substr(0, 10) : null; return this.value ? this.value.substr(0, 10) : null;
@@ -87,18 +103,6 @@ export default {
set(value) { set(value) {
this.date = this.dateOnly + " " + value; this.date = this.dateOnly + " " + value;
} }
},
formatTime() {
return this.value
? this.dayjs(this.value).format(this.locale.shortTimeFormat)
: "";
//Note in original code this would be parsed expecting source value to be in UTC format coming in but display in local time format
//so
// let momentObj = this.$moment.utc();
// if (this.value) {
// momentObj = this.$moment.utc(this.value);
// }
// return momentObj.local().format("h:mm a");
} }
} }
}; };

View File

@@ -50,7 +50,13 @@
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<gz-date-time-picker label="Start" :dayjs="this.dayjsLib" :locale="this.lc" v-model="obj.startDate"></gz-date-time-picker> <gz-date-time-picker
label="Start"
:dayjs="this.dayjsLib"
:locale="this.lc"
v-model="obj.startDate"
></gz-date-time-picker>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>