awesome-timeline-react 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2850,6 +2850,37 @@ var Timeline = forwardRef3(
2850
2850
  );
2851
2851
  }
2852
2852
  }, []);
2853
+ const fitStart = new Date(
2854
+ startDate.getFullYear(),
2855
+ startDate.getMonth(),
2856
+ startDate.getDate(),
2857
+ startDate.getHours(),
2858
+ 0,
2859
+ 0
2860
+ ).getTime() / 1e3;
2861
+ const fitEnd = new Date(
2862
+ endDate.getFullYear(),
2863
+ endDate.getMonth(),
2864
+ endDate.getDate(),
2865
+ endDate.getHours(),
2866
+ 0,
2867
+ 0
2868
+ ).getTime() / 1e3;
2869
+ const lastFitRef = useRef7([fitStart, fitEnd]);
2870
+ useEffect6(() => {
2871
+ var _a;
2872
+ if (lastFitRef.current[0] === fitStart && lastFitRef.current[1] === fitEnd) {
2873
+ return;
2874
+ }
2875
+ lastFitRef.current = [fitStart, fitEnd];
2876
+ setWindowTime([fitStart, fitEnd]);
2877
+ const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
2878
+ if (width) {
2879
+ const windowDuration = fitEnd - fitStart;
2880
+ setTick(windowDuration / width);
2881
+ setCellWidth(width / (windowDuration / 3600));
2882
+ }
2883
+ }, [fitStart, fitEnd]);
2853
2884
  useEffect6(() => {
2854
2885
  if (bodyRef.current) {
2855
2886
  setScrollWidth(