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: 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)
|
todo: all custom controls are fucked (mostly)
|
||||||
wont' start with initial value, WTF????????
|
wont' start with initial value, WTF????????
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default {
|
|||||||
},
|
},
|
||||||
readonlyFormat() {
|
readonlyFormat() {
|
||||||
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||||
this.internalValue,
|
this.value,
|
||||||
this.timeZoneName,
|
this.timeZoneName,
|
||||||
this.languageName,
|
this.languageName,
|
||||||
this.hour12
|
this.hour12
|
||||||
@@ -95,34 +95,6 @@ export default {
|
|||||||
},
|
},
|
||||||
updateValue() {
|
updateValue() {
|
||||||
let vm = this;
|
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;
|
let dateValue = vm.$refs.dateField.$refs.input.value;
|
||||||
if (!dateValue) {
|
if (!dateValue) {
|
||||||
let v = new Date();
|
let v = new Date();
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<template v-if="!readonly">
|
<template v-if="!readonly">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
ref="timeField"
|
ref="timeField"
|
||||||
:value="timeControlFormat()"
|
:value="timeValue"
|
||||||
@input="handleTimeInput"
|
@input="updateValue()"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:label="label"
|
:label="label"
|
||||||
@@ -31,15 +31,10 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalValue: null,
|
|
||||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName()
|
timeZoneName: window.$gz.locale.getBrowserTimeZoneName()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
value(val) {
|
|
||||||
this.internalValue = val;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
label: String,
|
label: String,
|
||||||
rules: Array,
|
rules: Array,
|
||||||
@@ -53,6 +48,14 @@ export default {
|
|||||||
},
|
},
|
||||||
testId: String
|
testId: String
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
timeValue() {
|
||||||
|
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||||
|
this.value,
|
||||||
|
this.timeZoneName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
allErrors() {
|
allErrors() {
|
||||||
let ret = "";
|
let ret = "";
|
||||||
@@ -66,25 +69,19 @@ export default {
|
|||||||
},
|
},
|
||||||
readonlyFormat() {
|
readonlyFormat() {
|
||||||
return window.$gz.locale.utcDateToShortTimeLocalized(
|
return window.$gz.locale.utcDateToShortTimeLocalized(
|
||||||
this.internalValue,
|
this.value,
|
||||||
this.timeZoneName,
|
this.timeZoneName,
|
||||||
this.languageName,
|
this.languageName,
|
||||||
this.hour12
|
this.hour12
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
timeControlFormat() {
|
updateValue() {
|
||||||
//hh:mm:ss in 24 hour format
|
let vm = this;
|
||||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
let dateValue = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||||
this.internalValue,
|
vm.value,
|
||||||
this.timeZoneName
|
vm.timeZoneName
|
||||||
);
|
);
|
||||||
},
|
if (!dateValue) {
|
||||||
handleTimeInput(value) {
|
|
||||||
let DatePortion = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
|
||||||
this.internalValue,
|
|
||||||
this.timeZoneName
|
|
||||||
);
|
|
||||||
if (!DatePortion) {
|
|
||||||
let v = new Date();
|
let v = new Date();
|
||||||
let fullYear = v.getFullYear();
|
let fullYear = v.getFullYear();
|
||||||
let fullMonth = v.getMonth() + 1;
|
let fullMonth = v.getMonth() + 1;
|
||||||
@@ -95,14 +92,52 @@ export default {
|
|||||||
if (fullDay < 10) {
|
if (fullDay < 10) {
|
||||||
fullDay = "0" + fullDay.toString();
|
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.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>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user