views:

783

answers:

1

Does anybody know of something similar to Date.js in Ruby? Something that would be able to return a date object from something like: "two weeks from today". The Remember the Milk webapp incorporates this feature into their system and it is incredibly easy to use.

I would use the Date.js library itself but because it is on the client side it has its limitations. If the user doesn't have javascript enabled the functionality would be lost. This would affect mobile phone users who would, ideally, use our system via text message (sms).

I would love to use a solution that's already out there but if not how hard would it be to port this code into Ruby? I really don't know much about natural language interpretation but it seems like it would take some time.

Thanks.

+11  A: 

Do not forget that everything being an object in Ruby, you have already some pretty readable statement from the language itself:

2.weeks.from_now.utc

would be the equivalent of "two weeks from today".

However, for real natural language, may be chronic might be a more specialized library at rubyforge.

Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
VonC