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

Date Picker Off By 1 Day #692

Closed
VISWESWARAN1998 opened this issue Feb 25, 2023 · 2 comments
Closed

Date Picker Off By 1 Day #692

VISWESWARAN1998 opened this issue Feb 25, 2023 · 2 comments
Labels

Comments

@VISWESWARAN1998
Copy link

When using this date picker anywhere between 12:00 AM to 12:59 AM (I suspect) the picked date is off by one day!

For example my code has mode selected to date:

<DateTimePickerModal
    isVisible={dp_visible}
    mode="date"                    
    onConfirm={handleConfirm}
    onCancel={hideDatePicker}
/>

And I am picking 21st of February 2023 and I would expect the results to come 21st of February but the picked date is shown for 20th of February like this:

A date has been picked:  2023-02-20
Original date  2023-02-20T17:52:01.000Z

My handleConfirm code:

const handleConfirm = (date) => {
    console.log("A date has been picked: ", date.toISOString().split('T')[0]);
    console.log("Original date ", date);        
    hideDatePicker();
};

Note:

Date picker is usually working fine on my working hours (09:00 AM to 06:00PM)

Platforms

Both

@mmazzarolo
Copy link
Owner

👋 I'm sorry but I won't be able to help you unless you follow the issue template.

@shahawi
Copy link

shahawi commented Feb 27, 2023

This may work
timeZoneOffsetInMinutes={0}

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

No branches or pull requests

3 participants