This commit is contained in:
@@ -72,6 +72,9 @@ export default {
|
|||||||
},
|
},
|
||||||
formats: {
|
formats: {
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$"
|
currencySymbol: "$",
|
||||||
|
shortDateFormat: "YYYY-MM-DD",
|
||||||
|
shortTimeFormat: "hh:mm:ss A",
|
||||||
|
shortDateAndTimeFormat: "YYYY-MM-DD hh:mm:ss A"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,13 @@
|
|||||||
</template> <script>
|
</template> <script>
|
||||||
export default {
|
export default {
|
||||||
data: () => ({ date: null, modal: false, modal2: false }),
|
data: () => ({ date: null, modal: false, modal2: false }),
|
||||||
props: { label: String, value: String, readonly: Boolean },
|
props: {
|
||||||
|
label: String,
|
||||||
|
value: String,
|
||||||
|
readonly: Boolean,
|
||||||
|
dayjs: Function,
|
||||||
|
locale: Object
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
date() {
|
date() {
|
||||||
this.$emit("input", this.date);
|
this.$emit("input", this.date);
|
||||||
@@ -52,29 +58,18 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formatDateTime() {
|
formatDateTime() {
|
||||||
return this.value.toString();
|
return this.value
|
||||||
// let momentObj = this.$moment.utc();
|
? this.dayjs(this.value).format(this.locale.shortDateAndTimeFormat)
|
||||||
// if (this.value) {
|
: "";
|
||||||
// momentObj = this.$moment.utc(this.value);
|
|
||||||
// }
|
|
||||||
// return momentObj.local().format("dddd MM/DD/YYYY h:mm a");
|
|
||||||
},
|
},
|
||||||
formatDate() {
|
formatDate() {
|
||||||
return this.value.toString();
|
return this.value
|
||||||
// let momentObj = this.$moment.utc();
|
? this.dayjs(this.value).format(this.locale.shortTimeFormat)
|
||||||
// if (this.value) {
|
: "";
|
||||||
// momentObj = this.$moment.utc(this.value);
|
|
||||||
// }
|
|
||||||
// return momentObj.local().format("dddd MM/DD/YYYY");
|
|
||||||
},
|
},
|
||||||
dateOnly: {
|
dateOnly: {
|
||||||
get() {
|
get() {
|
||||||
return this.value ? this.value.substr(0, 10) : null;
|
return this.value ? this.value.substr(0, 10) : null;
|
||||||
// let momentObj = this.$moment.utc();
|
|
||||||
// if (this.value) {
|
|
||||||
// momentObj = this.$moment.utc(this.value);
|
|
||||||
// }
|
|
||||||
// return momentObj.local().format("YYYY-MM-DD");
|
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.date = value + " " + this.timeOnly;
|
this.date = value + " " + this.timeOnly;
|
||||||
@@ -94,7 +89,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatTime() {
|
formatTime() {
|
||||||
return this.value ? this.value.substr(11, 8) : null;
|
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();
|
// let momentObj = this.$moment.utc();
|
||||||
// if (this.value) {
|
// if (this.value) {
|
||||||
// momentObj = this.$moment.utc(this.value);
|
// momentObj = this.$moment.utc(this.value);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
</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" 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>
|
||||||
@@ -95,6 +95,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
obj: {},
|
obj: {},
|
||||||
lc: locale,
|
lc: locale,
|
||||||
|
dayjsLib: dayjs,
|
||||||
theDate: new Date(),
|
theDate: new Date(),
|
||||||
date: new Date().toISOString().substr(0, 10),
|
date: new Date().toISOString().substr(0, 10),
|
||||||
menu: false,
|
menu: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user