Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endDate is undefined on range date picker #71

Open
SahinoorHUB opened this issue Feb 25, 2024 · 3 comments
Open

endDate is undefined on range date picker #71

SahinoorHUB opened this issue Feb 25, 2024 · 3 comments

Comments

@SahinoorHUB
Copy link

Description
I tried to get endDate from this date picker. The start date is given properly but then the end date is undefined.

Console Log

LOG start "2024-02-06T18:30:00.000Z"
LOG end undefined

My Code

const DateRangePickerModel = () => {  
    const [startDate, setStartDate] = useState(dayjs());
    const [endDate, setEndDate] = useState(dayjs()); 
    const setDate =  (startDate: any, endDate: any) => { 
        console.log("start", startDate); 
        console.log("end", endDate); 
    };
    
 
    return (
        <View style={styles.container}>
            <DateTimePicker
                mode="range" 
                startDate={startDate} 
                endDate={endDate}
                onChange={({startDate, endDate}) => setDate(startDate, endDate)}
                displayFullDays={true}
                timePicker={false}
                selectedItemColor={Colors.ui_dark_bg}
                selectedTextStyle={styles.selectedTextStyle} 
                headerButtonStyle={styles.headerButtonStyle}
                headerButtonColor={Colors.color_white}
                headerTextStyle={styles.headerTextStyle} 
                todayContainerStyle={styles.todayContainerStyle} 
            />  
            
        </View>
    );
};

Additional Information
react: 18.2.0
react-native: 0.73.4
react-native-ui-datepicker": 2.0.1,

@sirlojik
Copy link

sirlojik commented Mar 3, 2024

I am also experiencing the same issue. I can't select start or end date. when i tap a date i get the feedback reported above

@YaoHuiJi
Copy link

Same issue here, I downgrade to 1.0.11, it looks like v2.x break many things, and not mentioned in the release log, like onChange(it is onValueChange in 1.0.11) return a dayjs object not a js date, and time picker performance issue still exists...It's a little frustrating

@jadevdl
Copy link

jadevdl commented May 22, 2024

Hello! Same issue using:

  • react-native-ui-datepicker: 2.0.2
  • react 18.2.0
  • react-native: 0.74.1

I can select a startDate though, just not the endDate that is always undefined.
@farhoudshapouran do you know if there is any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants