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

Before/after modifiers issue with timezone #307

Closed
ghost opened this issue Apr 25, 2017 · 11 comments
Closed

Before/after modifiers issue with timezone #307

ghost opened this issue Apr 25, 2017 · 11 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Apr 25, 2017

I want to disable all days from current day, for that I have used
const range = { before: new Date() } <DayPicker initialMonth={ new Date() } disabledDays={range} selectedDays={ new Date() } onDayClick={this.handleDayClick} />

But it disabled current day as well, i.e. if today is 25th of april then all days before 25th should get disabled and current date i.e. 25th should get selected.
Can anyone please help me what went wrong here?

@gpbl
Copy link
Owner

gpbl commented Apr 25, 2017

Could you please replicate your issue in a jsfiddle?

https://jsfiddle.net/pkdcqvpk/

thanks!

@ghost
Copy link
Author

ghost commented Apr 25, 2017

@gpbl I have just open your JSfiddle link and I was able to replicate this issue. Please see this screenshot.

date

Today is 25th of april but still it is shown disabled.

@gpbl
Copy link
Owner

gpbl commented Apr 25, 2017

interesting ! thanks. what is your timezone?

@ghost
Copy link
Author

ghost commented Apr 25, 2017

@gpbl My timezone is IST

@gpbl gpbl added bug and removed needs more info labels Apr 25, 2017
@gpbl
Copy link
Owner

gpbl commented Apr 25, 2017

Thanks, I can replicate it! Until I don't publish the fix, as workaround you can use:

 <DayPicker 
    disabledDays={ { 
        before: new Date().setHours(0,0,0,0)  
    }} 
/>

See the updated jsfiddle.

@ghost
Copy link
Author

ghost commented Apr 25, 2017

@gpbl Thanks for workaround, I will use it for development now, and I will wait for proper fix.

@gpbl gpbl self-assigned this Apr 25, 2017
@gpbl gpbl added this to the v5.3.0 milestone Apr 25, 2017
@gpbl gpbl changed the title Before modifer is not working correctly. Before/after modifiers issue with timezone Apr 25, 2017
@gpbl gpbl closed this as completed in #308 Apr 25, 2017
@gpbl
Copy link
Owner

gpbl commented Apr 25, 2017

@ktusharprdxn please upgrade to v5.3.0

@ghost
Copy link
Author

ghost commented Apr 26, 2017

Hey @gpbl Thanks for the quick fix. 👍

@martin-svk
Copy link

This fix broke my code (v5.2.3 works good), and what was before indicated as disabled is no longer working.

@gpbl
Copy link
Owner

gpbl commented May 4, 2017

@martin-svk could you please replicate your problem https://jsfiddle.net/gpbl/cggxvq6t/ and eventually open a new issue? thanks

@martin-svk
Copy link

@gpbl Ok, i created #324

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

2 participants