Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 331313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:45:46+00:00 2026-05-12T09:45:46+00:00

I have a select_date that I want to restrict the months that a user

  • 0

I have a select_date that I want to restrict the months that a user can select.

<%= select_date(Time.now, :order => [:month, :day, :year ], :datetime_separator => '-', :time_separator => ':', :discard_seconds => true, :discard_minutes => true, :start_month => Time.now.month, :end_month => Time.now.month +1, :start_year => Time.now.year, :end_year => Time.now.year, :prefix => 'start_date') %>

Yet, there doesn’t seem to be a way to do this. You can’t restrict the number of months a select_date displays. Anyone have a way around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:45:46+00:00Added an answer on May 12, 2026 at 9:45 am

    There isn’t a way, that I know of, to solve this using Rails.

    Instead I used this:

    http://code.google.com/p/calendardateselect/

    restrict the date range as such:

    <%= f.calendar_date_select :start_date, :embedded => true, :valid_date_check => "( (date.stripTime() < ((new Date()).stripTime()).setMonth(new Date().getMonth() + 1)) && ( date.stripTime().setDate(date.getDate() + 1) > (new Date()).stripTime()) )", :year_range => [Time.now.year, Time.now.year], :time => false %>
    

    This allows me to limit the amount of time that a user can select by any range, but in my case by month.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
I have a UIDatePicker that well, allows you to select a date (not time).
I have a date picker that allows a user to select a date, by
I want to have a select statement inside the mysql trigger that has the
i have set the timezone to any time zone that the user have for
I have a query that looks like this SELECT * from myTable WHERE Date
I am trying to find a date picker that can show dates to select
I have a asp:textbox with a OnTextChanged event that I want to fire when
I have a form for a nested resource (Client :has_many Workouts) that I want
I have a large amount of text data that I want to display in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.