HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -69,20 +69,6 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
/* Xeslint-disable */
|
||||
|
||||
/*https://alligator.io/vuejs/add-v-model-support/
|
||||
"TimeSpanDays": "days",
|
||||
"TimeSpanHours": "hours",
|
||||
"TimeSpanMinutes": "minutes",
|
||||
"TimeSpanSeconds": "seconds", */
|
||||
//example serialized json TimeSpans
|
||||
//seems to be DD.HH:MM:SS.ms at it's most characters
|
||||
//two colons always with an optional period at each end to separate days and ms
|
||||
//we don't support or need MS and can safely ignore them
|
||||
//so just look for a period at the top and the rest is split by colons
|
||||
//maybe split by colon first then subsplit first and last elements into days and MS
|
||||
//{"data":{"testTSDaysWMS":"22.10:15:22.0330000","testTSHMS":"05:16:33","testTS_DHMS":"5.10:15:33","testTS_MS":"00:15:33","testTS_S":"00:00:33","testTS_D":"22.00:00:00"}}
|
||||
export default {
|
||||
props: {
|
||||
label: { type: String, default: null },
|
||||
@@ -100,7 +86,7 @@ export default {
|
||||
return this.errorMessages != null && this.errorMessages.length > 0;
|
||||
},
|
||||
splitSpan() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
let theDays = 0;
|
||||
let theHours = 0;
|
||||
let theMinutes = 0;
|
||||
@@ -112,10 +98,10 @@ export default {
|
||||
theMinutes = 0;
|
||||
theSeconds = 0;
|
||||
} else {
|
||||
let work = vm.value.split(":");
|
||||
const work = vm.value.split(":");
|
||||
//has days?
|
||||
if (work[0].includes(".")) {
|
||||
let dh = work[0].split(".");
|
||||
const dh = work[0].split(".");
|
||||
theDays = Number(dh[0]);
|
||||
theHours = Number(dh[1]);
|
||||
} else {
|
||||
@@ -124,7 +110,7 @@ export default {
|
||||
theMinutes = Number(work[1]);
|
||||
//has milliseconds? (ignore them)
|
||||
if (work[2].includes(".")) {
|
||||
let dh = work[2].split(".");
|
||||
const dh = work[2].split(".");
|
||||
theSeconds = Number(dh[0]);
|
||||
} else {
|
||||
theSeconds = Number(work[2]);
|
||||
@@ -149,16 +135,14 @@ export default {
|
||||
return ret;
|
||||
},
|
||||
updateSpan() {
|
||||
//{"data":{"testTSDaysWMS":"22.10:15:22.0330000","testTSHMS":"05:16:33","testTS_DHMS":"5.10:15:33","testTS_MS":"00:15:33","testTS_S":"00:00:33","testTS_D":"22.00:00:00"}}
|
||||
// DD.HH:MM:SS.ms
|
||||
let ret = "";
|
||||
//NOTE: even though a user may type a text value into the input, because it's set to "Number"
|
||||
//it always has a value of zero if it's not a digit even though the user typed Q for example (firefox at least)
|
||||
//so no parsing here to handle weird entries is required AFAICT
|
||||
let daysValue = this.$refs.daysPicker.$refs.input.value || 0;
|
||||
let hoursValue = this.$refs.hoursPicker.$refs.input.value || 0;
|
||||
let minutesValue = this.$refs.minutesPicker.$refs.input.value || 0;
|
||||
let secondsValue = this.$refs.secondsPicker.$refs.input.value || 0;
|
||||
const daysValue = this.$refs.daysPicker.$refs.input.value || 0;
|
||||
const hoursValue = this.$refs.hoursPicker.$refs.input.value || 0;
|
||||
const minutesValue = this.$refs.minutesPicker.$refs.input.value || 0;
|
||||
const secondsValue = this.$refs.secondsPicker.$refs.input.value || 0;
|
||||
|
||||
if (daysValue > 0) {
|
||||
ret = `${daysValue}.`;
|
||||
|
||||
Reference in New Issue
Block a user