Forum: Ruby recurring intervals in ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F48118fe74b0c7f6fd82a0ee422fa34e?d=identicon&s=25 snacktime (Guest)
on 2007-01-19 16:30
(Received via mailing list)
I'm setting about to write a mini language of sorts for defining
recurring intervals that will be used in a recurring billing
application.  In the past I wrote a simpler version in perl using the
awsome Date::Manip module, and am looking for the best way to do it in
ruby.  I'm not too concerned about the date calculations themselves
I'm mainly thinking about how to parse the language.  My first thought
is to just use a parser such as lemon or ragel.  Any suggestions?  A
recurring definition would be compiled into a set of billing dates.

Recurring definitions might look something like the following:

* Every month for 12 months starting in 1 month

* Every week for 1 week starting in one week then every month for 12

* Every month until cancelled starting in one week
C5b0a0cf40eb23497068889c8fb20a18?d=identicon&s=25 (Guest)
on 2007-09-25 22:41
(Received via mailing list)
You may to look at the chronic library

It supports functions similar to what you are looking for.

You can parse things like:

this monday 07:30
may 15th
tomorrow morning
yesterday at 9:00
tomorrow at 11pm
wednesday last week
1 month from now
last friday in January

This topic is locked and can not be replied to.