This commit is contained in:
@@ -44,6 +44,7 @@ todo: Customer User list form side track but relevant to this
|
||||
todo: Test server down while polling in release mode, does it recover when server starts again or...?
|
||||
|
||||
|
||||
todo: read only version of duration, datetime, date, time, currency
|
||||
|
||||
todo: all custom controls are fucked (mostly)
|
||||
wont' start with initial value, WTF????????
|
||||
|
||||
@@ -87,7 +87,7 @@ export default {
|
||||
},
|
||||
readonlyFormat() {
|
||||
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
this.internalValue,
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
this.hour12
|
||||
@@ -95,34 +95,6 @@ export default {
|
||||
},
|
||||
updateValue() {
|
||||
let vm = this;
|
||||
|
||||
// let dateValue = vm.$refs.dateField.$refs.input.value;
|
||||
// let DatePortion = dateValue;
|
||||
// if (!DatePortion) {
|
||||
// let v = new Date();
|
||||
// let fullYear = v.getFullYear();
|
||||
// let fullMonth = v.getMonth() + 1;
|
||||
// if (fullMonth < 10) {
|
||||
// fullMonth = "0" + fullMonth.toString();
|
||||
// }
|
||||
// let fullDay = v.getDate();
|
||||
// if (fullDay < 10) {
|
||||
// fullDay = "0" + fullDay.toString();
|
||||
// }
|
||||
// DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
// }
|
||||
|
||||
// let timeValue = vm.$refs.timeField.$refs.input.value;
|
||||
// let TimePortion = timeValue;
|
||||
// if (!TimePortion) {
|
||||
// TimePortion = "00:00:00";
|
||||
// }
|
||||
|
||||
// let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
// DatePortion + "T" + TimePortion,
|
||||
// this.timeZoneName
|
||||
// );
|
||||
|
||||
let dateValue = vm.$refs.dateField.$refs.input.value;
|
||||
if (!dateValue) {
|
||||
let v = new Date();
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<template v-if="!readonly">
|
||||
<v-text-field
|
||||
ref="timeField"
|
||||
:value="timeControlFormat()"
|
||||
@input="handleTimeInput"
|
||||
:value="timeValue"
|
||||
@input="updateValue()"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
:label="label"
|
||||
@@ -31,15 +31,10 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
internalValue: null,
|
||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName()
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.internalValue = val;
|
||||
}
|
||||
},
|
||||
|
||||
props: {
|
||||
label: String,
|
||||
rules: Array,
|
||||
@@ -53,6 +48,14 @@ export default {
|
||||
},
|
||||
testId: String
|
||||
},
|
||||
computed: {
|
||||
timeValue() {
|
||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
allErrors() {
|
||||
let ret = "";
|
||||
@@ -66,25 +69,19 @@ export default {
|
||||
},
|
||||
readonlyFormat() {
|
||||
return window.$gz.locale.utcDateToShortTimeLocalized(
|
||||
this.internalValue,
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
this.hour12
|
||||
);
|
||||
},
|
||||
timeControlFormat() {
|
||||
//hh:mm:ss in 24 hour format
|
||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
this.internalValue,
|
||||
this.timeZoneName
|
||||
updateValue() {
|
||||
let vm = this;
|
||||
let dateValue = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
vm.value,
|
||||
vm.timeZoneName
|
||||
);
|
||||
},
|
||||
handleTimeInput(value) {
|
||||
let DatePortion = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
this.internalValue,
|
||||
this.timeZoneName
|
||||
);
|
||||
if (!DatePortion) {
|
||||
if (!dateValue) {
|
||||
let v = new Date();
|
||||
let fullYear = v.getFullYear();
|
||||
let fullMonth = v.getMonth() + 1;
|
||||
@@ -95,14 +92,52 @@ export default {
|
||||
if (fullDay < 10) {
|
||||
fullDay = "0" + fullDay.toString();
|
||||
}
|
||||
DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
dateValue = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
}
|
||||
let newValue = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
DatePortion + "T" + value,
|
||||
|
||||
let timeValue = vm.$refs.timeField.$refs.input.value;
|
||||
if (!timeValue) {
|
||||
timeValue = "00:00:00";
|
||||
}
|
||||
|
||||
let ret = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
dateValue + "T" + timeValue,
|
||||
this.timeZoneName
|
||||
);
|
||||
this.$emit("input", newValue);
|
||||
this.$emit("input", ret);
|
||||
}
|
||||
}
|
||||
// timeControlFormat() {
|
||||
// //hh:mm:ss in 24 hour format
|
||||
// return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
// this.internalValue,
|
||||
// this.timeZoneName
|
||||
// );
|
||||
// },
|
||||
// handleTimeInput(value) {
|
||||
// let DatePortion = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
// this.internalValue,
|
||||
// this.timeZoneName
|
||||
// );
|
||||
// if (!DatePortion) {
|
||||
// let v = new Date();
|
||||
// let fullYear = v.getFullYear();
|
||||
// let fullMonth = v.getMonth() + 1;
|
||||
// if (fullMonth < 10) {
|
||||
// fullMonth = "0" + fullMonth.toString();
|
||||
// }
|
||||
// let fullDay = v.getDate();
|
||||
// if (fullDay < 10) {
|
||||
// fullDay = "0" + fullDay.toString();
|
||||
// }
|
||||
// DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
// }
|
||||
// let newValue = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
// DatePortion + "T" + value,
|
||||
// this.timeZoneName
|
||||
// );
|
||||
// this.$emit("input", newValue);
|
||||
// }
|
||||
// }
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user