diff --git a/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx b/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx index ef878ce..a48cff0 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx @@ -1,22 +1,16 @@ -// /components/modules/kue705FO/charts/DateRangePicker.tsx -// /components/modules/kue705FO/charts/DateRangePicker.tsx import React from "react"; import DatePicker from "react-datepicker"; -import { useSelector } from "react-redux"; +import { useSelector, useDispatch } from "react-redux"; import { RootState } from "../../../../../redux/store"; -import "react-datepicker/dist/react-datepicker.css"; - -// ✅ Props-Definition für die Komponente hinzugefügt -interface DateRangePickerProps { - setVonDatum: (date: Date) => void; - setBisDatum: (date: Date) => void; -} - -const DateRangePicker: React.FC = ({ +import { setVonDatum, setBisDatum, -}) => { - // Redux-Werte abrufen +} from "../../../../../redux/slices/kabelueberwachungChartSlice"; +import "react-datepicker/dist/react-datepicker.css"; + +const DateRangePicker: React.FC = () => { + const dispatch = useDispatch(); + const reduxVonDatum = useSelector( (state: RootState) => state.kabelueberwachungChart.vonDatum ); @@ -32,7 +26,7 @@ const DateRangePicker: React.FC = ({ selected={reduxVonDatum ? new Date(reduxVonDatum) : new Date()} onChange={(date) => { if (date) { - setVonDatum(date); + dispatch(setVonDatum(date.toISOString().split("T")[0])); } }} selectsStart @@ -49,7 +43,7 @@ const DateRangePicker: React.FC = ({ selected={reduxBisDatum ? new Date(reduxBisDatum) : new Date()} onChange={(date) => { if (date) { - setBisDatum(date); + dispatch(setBisDatum(date.toISOString().split("T")[0])); } }} selectsEnd diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index 30ec783..f24eb80 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -126,14 +126,28 @@ const LoopMeasurementChart = () => { }, [dispatch, formatierteDaten] ); + //-------------------------------------------------------------------------------- useEffect(() => { if (formatierteDaten.length) { + console.log("🔍 Redux vonDatum:", vonDatum); + console.log("🔍 Redux bisDatum:", bisDatum); + + //console.log("🔍 Verfügbare Zeitpunkte in formatierteDaten:"); + /* formatierteDaten.forEach((d, index) => { + console.log( + `${index}: ${new Date(d.zeit).toISOString().split("T")[0]}` + ); + }); + */ const startIndex = formatierteDaten.findIndex( (d) => new Date(d.zeit).toISOString().split("T")[0] === vonDatum ); + //console.log("startIndex in Brush ", startIndex); + const endIndex = formatierteDaten.findIndex( (d) => new Date(d.zeit).toISOString().split("T")[0] === bisDatum ); + //console.log("endIndex in Brush ", endIndex); if (startIndex !== -1 && endIndex !== -1) { dispatch( @@ -147,6 +161,7 @@ const LoopMeasurementChart = () => { } } }, [vonDatum, bisDatum, formatierteDaten, dispatch]); + //---------------------------------------------------------------- return (
diff --git a/config/webVersion.ts b/config/webVersion.ts index 84a139f..7e7fc6d 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.121"; +const webVersion = "1.6.122"; export default webVersion;