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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Atzen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 http://www.nedforce.nl -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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! On Aug 12, 2007, at 4:31 PM, Jacob Atzen 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you! This looks to do what I need to solve and more! Thanks for the tip. -Scott On Aug 12, 2007, at 5:17 PM, Roderick van Domburg 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. > > 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---