diff --git a/docs/index.html b/docs/index.html
index f147027..7cc5282 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -192,7 +192,6 @@
Demo
@@ -1415,6 +1414,11 @@ About me
valueInput.value = event.detail ? JSON.stringify(event.detail) : "";
});
+ valueInput.addEventListener("change", (event) => {
+ datepicker.setAttribute("value", event.target.value);
+ updateDemoCode();
+ });
+
idInput.addEventListener("change", (event) => {
datepicker.setAttribute("id", event.target.value);
updateDemoCode();
diff --git a/src/components/inclusive-dates/inclusive-dates.tsx b/src/components/inclusive-dates/inclusive-dates.tsx
index 061358d..0208a90 100644
--- a/src/components/inclusive-dates/inclusive-dates.tsx
+++ b/src/components/inclusive-dates/inclusive-dates.tsx
@@ -490,9 +490,16 @@ export class InclusiveDates {
}
@Watch("value")
- watchValue() {
- if (Boolean(this.value) && !this.isRangeValue(this.value)) {
- this.internalValue = this.value as string;
+ watchValue(newValue) {
+ if (this.range) {
+ const parsedValue = JSON.parse(newValue.replace(/'/g, '"'));
+ this.internalValue = parsedValue;
+ this.pickerRef.value = parsedValue.map((date) =>
+ removeTimezoneOffset(new Date(date as string))
+ );
+ } else {
+ this.internalValue = newValue;
+ this.pickerRef.value = removeTimezoneOffset(new Date(newValue));
}
}
|