Skip to content
koen handekyn edited this page Jan 5, 2016 · 4 revisions

Welcome to the simple_calendar wiki!

how to calculate the date range for a month view

the below snippets calculates the date range exactly like the lib does. so you can then use this date range for filtering your events in the database (storage) layer.

start_date = params.fetch(:start_date, Date.today).to_date
date_range = start_date.beginning_of_month.beginning_of_week..start_date.end_of_month.end_of_week