From 8f4a56692e3c720ea807d66e644d496ae12953dc Mon Sep 17 00:00:00 2001 From: Igor Ramadas Date: Thu, 12 Sep 2024 22:50:55 +0200 Subject: [PATCH] Minor changes to the behaviour of the new dateRange based conditions. --- components/recipes/AddCondition.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/recipes/AddCondition.vue b/components/recipes/AddCondition.vue index fe05011..de0afda 100644 --- a/components/recipes/AddCondition.vue +++ b/components/recipes/AddCondition.vue @@ -60,7 +60,7 @@ no-filter > -
+
@@ -142,6 +142,9 @@ export default { isWeekday() { return this.selectedProperty?.value == "weekday" }, + isDateRange() { + return this.selectedProperty?.value == "dateRange" + }, isGarmin() { return this.selectedProperty?.value == "garmin.sensor" }, @@ -352,16 +355,16 @@ export default { } else if (this.isLocation) { result.value = this.locationInput.value result.friendlyValue = this.locationInput.address - } else if (this.selectedProperty.type == "time") { - const arrTime = result.value.split(":") - result.value = parseInt(arrTime[0]) * 3600 + parseInt(arrTime[1]) * 60 - result.friendlyValue = this.valueInput - } else if (this.selectedProperty.type == "date") { + } else if (this.isDateRange) { result.value = `${this.valueDateFrom},${this.valueDateTo}` const year = new Date().getFullYear() const fromDate = this.valueDateFrom.length == 5 ? this.$dayjs(`${year}-${this.valueDateFrom}`).format("MMM D") : this.$dayjs(this.valueDateFrom).format("MMM D, YYYY") const toDate = this.valueDateTo.length == 5 ? this.$dayjs(`${year}-${this.valueDateTo}`).format("MMM D") : this.$dayjs(this.valueDateTo).format("MMM D, YYYY") result.friendlyValue = `From ${fromDate} to ${toDate}` + } else if (this.selectedProperty.type == "time") { + const arrTime = result.value.split(":") + result.value = parseInt(arrTime[0]) * 3600 + parseInt(arrTime[1]) * 60 + result.friendlyValue = this.valueInput } }