Agile Web Development

Build it. Launch it. Love it.

Date Finder

Can find dates that match certain criteria. Eg:

The next three tuesdays:

    DateFinderBase.weekly.day(:tuesday).find(:max => 3)

The last Monday for the next three months:

    DateFinderBase.monthly.day(:monday).day_occurrence(:last).find(:max => 3)

You can string as many conditions together as you like:

  day(day) - A string (eg: friday), or an integer from 0 to 6 (0 = Sunday)
  day_number(number) - An integer, the day of the month.
  weekday - The day must be a weekday
  day_occurrence(type) - One of first, second, third, fourth, last. The day must be the given occurence in the month.
  month(month) - Like day, either a string or an integer from 1 to 12

Vitals

Repository http://svn.viney.net.nz/things/rails/plugins/date_finder/
License Rails' (MIT)
Tags Tag_red 1b525743337bc2f81b52623f9684657a back cheaper common date edit f= form from most near ollar ooking parse pig rom somewhat taken treaky
Rating (3 votes)
Owner Jonathan Viney
Created 20 September 2006

Comments

  • Avatar
    stefano
    9 February 2008

    Hi,

    This plugin not working in rails-2.0. There is a patch?

    Best regards Stafano

  • Avatar
    Luis
    14 May 2008

    Hi,

    I just programmed something similar (for 2.0), but used a different approach.

    I saved the model with a time_type for onetime events, events at a fixed date etc. then I saved a binary with 35 bits to determine on which days of the month or week the event should happen. Finally I calculate the binary values for the different search queries for the date I am looking for (but I separated the first, second etc. from the last, second-to-last etc. search).

    So I can search for all events on a specific date and can let the events happen on multiple days.

Add a comment