Twipped / Kalendae

A javascript date picker that just works.
MIT License
1.99k stars 285 forks source link

Allow day out of month clicks #51

Closed pfiller closed 12 years ago

pfiller commented 12 years ago

We use our calendar as a type of navigation. If I'm viewing the calendar at the beginning of August 2012, we don't want to force the user to navigate back to July to click July 31. They should just be able to click the greyed out July 31.

This pull request adds an option for these kind of clicks by setting dayOutOfMonthClickable: true. The default for this option is false as to not break current functionality.

burin commented 12 years ago

When using this option and selecting a dayOutOfMonth, my expectation is that when the calendar is hidden and opened again, the "focused month" should now be the month of the selected date. Is my assumption valid?

The reason I asked is because when I used this option, this is what happened, which I think is a little weird:

Open the calendar with August 7 selected

Select September 1, which is a dayOutOfMonth (which then does display: none to hide the calendar)

I change my mind and want to change it to September 15, so:

Open calendar with September 1 selected, but the focused month is still August (since I just set display:block)

I've tried calling draw() on the calendar, but it won't "reset" it back to where September would be in focus.

I also programmatically set dates using setSelected, which I also expect to "reset" the "focused month", but that may be unrelated.

pfiller commented 12 years ago

@burin that's an interesting UX problem we do not encounter in our use case because we're using the calendar as navigation (so it is totally built from scratch on new page load). I've submitted an attempt at fixing this problem in #55. Would appreciate any feedback you have to share.