Twipped / Kalendae

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

Multiple month view not obeying viewStartDate for February (or current month maybe?) #139

Closed yehudahkay closed 9 years ago

yehudahkay commented 9 years ago

Hi I am trying this

$('#calendar').kalendae({
                   mode: 'multiple', 
                   months: 3,
                   viewStartDate: '2/1/2015'
               });

If viewStartDate is set to a different month it will work. But if it is not set or set to February (current month) then the months shown are January, February, March. I see the same on the demo http://chipersoft.com/Kalendae/

yehudahkay commented 9 years ago

I fixed this by using

$('#calendar').kalendae({
                   mode: 'multiple', 
                   months: 3,
                   direction: 'today-future'
               });

Perhaps this is intentional? Although I'm not sure why it would work one way for the current month and different way for other months

Twipped commented 9 years ago

Yes, it is intentional. Multi-month views always center on the viewStartDate (or start on it for calendars showing an even number of months). The reason today-future changes this behavior is because the user would not be able to select a day prior to the current month, so there's no reason to show them that month. It works the opposite for today-past.

yehudahkay commented 9 years ago

Actually viewStartDate isn't centered when it is in the future rather it is the first month, so I'm not 100% sure I understood.

Twipped commented 9 years ago

It centers when there is no direction defined. It aligns against an edge when future or past directions are used.

yehudahkay commented 9 years ago

Hi Chipersoft, maybe I didn't explain 100%. If you use viewStartDate: '3/1/2015' it will start from May and move forward. If you use viewStartDate: '2/1/2015' it will put February in the middle. That's what I thought was inconsistent.

Twipped commented 9 years ago

it will start from May

May? Not March?

On Feb 18, 2015, at 11:23 AM, yehudahkay notifications@github.com wrote:

Hi Chipersoft, maybe I didn't explain 100%. If you use viewStartDate: '3/1/2015' it will start from May and move forward. If you use viewStartDate: '2/1/2015' it will put February in the middle. That's what I thought was inconsistent.

— Reply to this email directly or view it on GitHub.

yehudahkay commented 9 years ago

Sorry, March :-) I don't live in the US anymore

Twipped commented 9 years ago

Oh, I see. I don't remember if that was the intent, but I'm ok with keeping it that way.