Date and Time validator, updater

Can someone point me to a date/time validator or updater.

I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.

Figure there is some code or library out there already, if you
know one, please forward it.

Thank you!

Scott Parks wrote:

Can someone point me to a date/time validator or updater.

I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.

Figure there is some code or library out there already, if you
know one, please forward it.

You don’t really need a library to do this, it’s as simple as:

def validate
errors.add(“end”, “is before start”) unless start <= end
end


Cheers,

  • Jacob A.

Hi Scott,

Can someone point me to a date/time validator or updater.

I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.

Figure there is some code or library out there already, if you
know one, please forward it.

Jacob’s right, and if you’d like to do any further date/time validations
you should take a look at the validates_date plugin [1]. It’s got a neat
feature set and is well written too.

[1] http://svn.viney.net.nz/things/rails/plugins/validates_date_time


Roderick van Domburg

Thank you! This looks to do what I need to solve and more! Thanks
for the tip.
-Scott

You have got to be kidding me? It’s that easy? I think I need to
get my
head out of the book (examples) and read some of the more in depth
articles.

Thank you!