chrisdavies / tiny-date-picker

A small, modern, dependency-free date picker
https://chrisdavies.github.io/tiny-date-picker/
415 stars 87 forks source link

Is it possible to dynamically update the min/max options? #80

Closed nwessing closed 6 years ago

nwessing commented 6 years ago

I see that min/max able to be set on the options object passed in to initialize the date picker. But it's not clear to me how I would update those options after the date picker has been created.

chrisdavies commented 6 years ago

Hm. Most of the opts are assumed to be static after setup.

You can work around this by a combination of the inRange option and setState. When your min/max changes, you can setState to force a redraw, and the redraw will call your inRange function. Make sense?

nwessing commented 6 years ago

Thats a good idea. Right now I have it working just fine with destroying and recreating the date picker, but I will take a look at the inRange option.

chrisdavies commented 6 years ago

@nwessing, let me know if that works for you as a workaround. If so, I'll probably close this issue.

nwessing commented 6 years ago

I haven't tried it, I have it working just fine with destroying and recreating and I don't have the time to experiment further to see if this other methods works.

chrisdavies commented 6 years ago

No problem. I'll close as there seem to be reasonable workarounds for now.