excid3 / simple_calendar

A wonderfully simple calendar gem for Rails
http://excid3.github.io/simple_calendar
MIT License
1.58k stars 268 forks source link

previous button sets not expected params #248

Closed ilukashin closed 3 years ago

ilukashin commented 3 years ago

hello.

im using week calendar and by default its show current week. for example today for 2021-02-01 its render from '2021-02-01' to '2021-02-07'

when i press "Next" button (step 1*), its render next week from '2021-02-08' to '2021-02-15' and sets param first day of week: start_date=2021-02-08 ok, sounds good.

in my model i take weekly entities with something like this: MyModel.where(created_at: Date.parse(start_date)...(Date.parse(start_date) + 7.days)

but when i press "Previous" (step 2*) its render correct week from '2021-02-01' to '2021-02-07', but now sets in params last day of this week: start_date=2021-02-07 when i really expect: start_date=2021-02-01 and now my model returns wrong data.

not sure its a bug, maybe i do wrong?

*steps how to reproduce this i also checked month calendar - got same behavor

ilukashin commented 3 years ago

ok, it seems i missed part of docs from wiki https://github.com/excid3/simple_calendar/wiki its a solution for me.