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 9246521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:30:33+00:00 2026-06-18T09:30:33+00:00

I am using Rails 3.2.11 and am trying to use both jQuery UI Datepicker

  • 0

I am using Rails 3.2.11 and am trying to use both jQuery UI Datepicker and Timepicker, however I am facing problems when trying to use the minDate and maxDate properties of Datepicker.

My view for one page (in HAML), looks like this:

.field_section
  = f.label :date, "Date"
  %br
  = f.datepicker :date, :minDate => "-10y", :maxDate => "+1y", :dateFormat => "yy-mm-dd",
    :constrainInput => true, :showOtherMonths => true, :size => 10

I have jQuery UI 1.10 and everything works perfectly.

However, in a completely separate view, i also need a timepicker, so i include the jquery-ui-timepicker-addon.js file (version 1.20) in my application.js

The order of inclusion is:

  1. jQuery (1.8.3)
  2. jQuery UJS jQuery UI (specifically, autocomplete, datepicker and slider)
  3. Timepicker

Now, loading the first view (which only has a datepicker, not timepicker) gives me the following error in Chrome JS console, when i click on the datepicker input:

Error parsing the date string: Missing number at position 0
date string = -10y
date format = yy-mm-dd
Error parsing the date string: Missing number at position 0
date string = +1y
date format = yy-mm-dd 

Which is repeated another 5 or so times. The errors point to jquery-ui-timepicker-addon.js:1912, which, unhelpfully is just:

$.timepicker.log = function(err){
    if(window.console)
        console.log(err);
};

Oddly, if i remove the minDate and maxDate attributes from my view, the errors go away – but i want to use these options. Any idea what is going on?

Thanks

Update:
i have noticed if i pass minDate and maxDate as hard coded strings, ie

:minDate => "2000-01-01", :maxDate => "2014-01-01"

the errors go away. I assume this means there is an error with dateFormat (somewhere..?)

  • 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-06-18T09:30:34+00:00Added an answer on June 18, 2026 at 9:30 am

    So it looks like Timepicker does not understand relative dates. I think Timepicker attempts to always override Datepicker. With :minDate and :maxDate set to relative values (ie, +1y) Timepicker sees a format mismatch between +1y and yy-mm-dd for example – it does not seem to first convert the +1y to a Date object with format yy-mm-dd.

    The solution for me was to explicity put in Date objects:

    :minDate => Date.today - 10.years, :maxDate => Date.today + 1.years
    

    Which really isn’t as nice as +1y

    Issue raised on Github

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

Sidebar

Related Questions

I'm trying to use a repeatable section of datetimes in a rails app using
I'm trying to get mysql gem installed for use on rails, using jruby, can't
I am trying ti use carrierWave. I have installed imagemagic using homebrew and both
I am trying to use PDFKit using rails 3, I followed the railscast tutorial
I'm trying to send post request using rails controller, however i faced issue, when
I am using Ruby on Rails 3.0.10 and jQuery 1.6. I am trying to
I'm trying to set up rails to use both the ID and the Handle
Im using Rails 3.2.2 and am trying to use the ruby_gntp gem to send
I'm using rails 3 and am trying to use the in_place_editing plugin: http://github.com/wanglian/in_place_editing #
I'm using Backbone.js 0.9.2 from the Backbone-on-rails gem. I'm also trying to use the

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.