I use sinatra web framework and DataMapper.
I have code:
@wdata = Data.all(:date => ((DateTime.now - @interval.to_i)..DateTime.now))
When I want Data from last 24 hours I use @interval = 1, last 7 days @interval = 7.
How I should get data from e.g. last month or last year? Month can have 31, 30, 28 or 29 days I would like to distinguish this. I would e.g. get data from june last year, last two months, etc.
I searched in web for some tutorial, but I found only for ActiveRecord. 🙁
Perhaps there is more elegant solution, but you can do such ranges manually