simple_calendar
simple_calendar copied to clipboard
Previous button for generic calendars go only 1 day backwards
Thank you for this great gem for starters.
week_calendar
and month_calendar
work great.
It appears that for the simple calendar
helper, the "previous" button does not go backwards the same way than the "next" button goes forward. While the next button goes forward the number of days included in the range (4 by default), the previous button goes backward only one day.
Unless this behavior is intended for some reason, the fix would be as simple as this:
def url_for_previous_view
- view_context.url_for(@params.merge(start_date_param => (date_range.first - 1.day).iso8601))
+ view_context.url_for(@params.merge(start_date_param => (date_range.first - (date_range.count).days)).iso8601))
end
We could then override this method in MonthCalendar and WeekCalendar to keep view_context.url_for(@params.merge(start_date_param => (date_range.first - 1.day).iso8601))
Happy to push a Pull Request if needed Thanks!
Yeah, that probably should go back more days.
@excid3 PR is here: https://github.com/excid3/simple_calendar/pull/273