# Re: Suggestions for a date picker that supports mm/yyyy

**URL:** <https://www.ruby-forum.com/t/re-suggestions-for-a-date-picker-that-supports-mm-yyyy/79074>\
**Category:** Ruby\
**Created:** [December 12, 2006, 12:50am UTC](https://www.ruby-forum.com/t/re-suggestions-for-a-date-picker-that-supports-mm-yyyy/79074 "2006-12-12T00:50:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [December 12, 2006, 12:50am UTC](https://www.ruby-forum.com/t/re-suggestions-for-a-date-picker-that-supports-mm-yyyy/79074/1 "2006-12-12T00:50:41Z")

</div>

From: Jason V. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> Sent: Monday, December 11, 2006 4:30 PM  
> To: ruby-talk ML  
> Subject: Suggestions for a date picker that supports mm/yyyy
> 
> Does anyone have some suggestions for a date picker that supports  
> mm/yyyy.

Er, under what UI? Text/console? WxRuby? RubyCocoa? Rails?

Under the guess that you’re confusing “Ruby, the Language” with “Ruby on  
Rails, the Web Framework that happens to be implemented using Ruby”, you  
might want to re-ask your question on the Ruby on Rails group:  
[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk)

> Also, does anyone know the “best” way to validate a mm/yyyy  
> as “valid”? Meaning this month or the future?

How about this hack that probably fails near the last day of the month:

require ‘date’  
d1 = “12/2006”  
d2 = “13/2007”  
d3 = “10/2005”  
d4 = “11/2006”  
d5 = “12/2006”

[d1,d2,d3,d4,d5].each{ |datestring|  
begin  
d = Date.strptime( “28 #{datestring}”, ‘%d %m/%Y’ )  
raise if d \< Date.today  
puts “OK: #{d}”  
rescue  
puts “BAD DATE: #{datestring}”  
end  
}

#=\> OK: 2006-12-28  
#=\> BAD DATE: 13/2007  
#=\> BAD DATE: 10/2005  
#=\> BAD DATE: 11/2006  
#=\> OK: 2006-12-28

---

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [December 12, 2006, 5:31am UTC](https://www.ruby-forum.com/t/re-suggestions-for-a-date-picker-that-supports-mm-yyyy/79074/2 "2006-12-12T05:31:14Z")

</div>

Sorry, I definitely should have been clearer.

Under Rails I was also thinking Javascript/Ajax (technically). I’ll  
ask over in the RoR group too.

I asked the question here because I was thinking the validation would  
be in Ruby.

Thanks Paul and Gavin,  
Jason
