I wrote about this a while ago: http://hughevans.net/2008/09/25/date-range-string-conversions Cheers, Hugh
On Fri, Oct 23, 2009 at 4:30 PM, Ryan Bigg <[email protected]> wrote: > With the standard distance_of_time_in_words, you'll get something like > "about 2 months". > > I've overridden it in my plugin dotiw: http://github.com/radar/dotiw so > you can specify :only => [:months, days] as an option for > distance_of_time_in_words and it'll output in the syntax you would like. > > HTH, > Ryan > > 2009/10/23 Xavier Shay <[email protected]> > >> >> > (Date.new(2010, 1, 3) - Date.today).days >> => 72 days # My birthday! >> >> But I want: >> => 2 months and 11 days >> >> Is there a built in activesupport way to do this? I guess I want to >> normalize a date range. >> >> xav >> >> >> > > > -- > Ryan Bigg > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
