@bailierich/booking-components 2.1.2 → 2.1.3

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.
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { useState, useMemo } from 'react';
3
+ import { useState, useMemo, useEffect } from 'react';
4
4
  import { motion } from 'framer-motion';
5
5
  import { ChevronLeft, ChevronRight } from 'lucide-react';
6
6
  import type { DateSelectionSettings } from '../../../types';
@@ -119,6 +119,11 @@ export function DateSelection({
119
119
 
120
120
  const [currentMonth, setCurrentMonth] = useState(initialMonth);
121
121
 
122
+ // Reset calendar month when dates transition from mock to real (or vice versa)
123
+ useEffect(() => {
124
+ setCurrentMonth(initialMonth);
125
+ }, [initialMonth]);
126
+
122
127
  // Create a Set for O(1) lookup of available dates
123
128
  const availableDatesSet = useMemo(() => new Set(effectiveDates), [effectiveDates]);
124
129