From bc54fabe962f95fff36a73c5f4435da8b2c5c08a Mon Sep 17 00:00:00 2001 From: pk Date: Thu, 2 Jan 2025 22:28:12 +0100 Subject: [PATCH] Break the loop if a value was found when clicking an entry in the year selector. Otherwise it can pick up the value of the date picker itself. --- tp-date-picker.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tp-date-picker.js b/tp-date-picker.js index 3f1e49a..d06b9fc 100644 --- a/tp-date-picker.js +++ b/tp-date-picker.js @@ -347,12 +347,13 @@ class TpDatePicker extends FormElement(LitElement) { selectYear(e) { const elList = e.composedPath(); - elList.forEach(el => { + for (const el of elList) { if (el.value) { this.year = el.value; this.showYearSelector = false; + break; } - }); + } } }