Twipped / Kalendae

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

After changing .viewStartDate property, arrow navigation doesn't work #77

Closed Espesen closed 11 years ago

Espesen commented 11 years ago

After instantiating a new Kalendae object like this:

var kal = new Kalendae('calendar', {} );

calendar's arrow navigation keys work as excepted. But if I later do this:

var newDate = '2013-02-21'; kal.setSelected(newDate); kal.viewStartDate = newDate; kal.draw();

the selected date and calendar view moves to desired date but the arrow keys no longer work. In JS console, I get an error message "Object 2013-02-21 has no method 'add'". I tried different string formatting and even Date and moment objects as a value of newDate but with no luck.

hazanjon commented 11 years ago

I've made a Pull Request that fixes this problem: https://github.com/ChiperSoft/Kalendae/pull/85

Commit: https://github.com/hazanjon/Kalendae/commit/ed296d0d6d7485e76da5a1a3ea0ca4082b8d9b33

tagliala commented 11 years ago

Solved in commit eecd2f1

PS: do not use a string for the date, use a moment object:

var newDate = Kalendae.moment('2013-02-21');
kal.setSelected(newDate);
kal.viewStartDate = newDate;
kal.draw();