Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Wrong render of :date #140

Closed
alec-c4 opened this Issue · 11 comments

4 participants

@alec-c4

Hi, could you tell me plz - why on code
- semantic_form_for :profile, :html => { :method => :put }, :url => update_profile_path do |form|
- form.inputs do
= form.error_messages
= form.input :female, :as => :select, :collection => [["Male", false], ["Female", true]]
= form.input :birthdate, :as => :date, :start_year => 1900
= form.input :timezone, :as=> :time_zone
- form.buttons do
= form.commit_button "Save"

formtastic renders

  • Birthdate*
    1. Year 1900 1901 1902 1903 <option value="1904">1904</option> <option value="1905">1905</option> <option value="1906">1906</option> <option value="1907">1907</option> ........................ 2014
    2. Month 114 <option value="2">97</option> <option value="3">110</option> <option value="4">115</option> <option value="5">108</option> <option value="6">97</option> <option value="7">116</option> <option value="8">105</option> <option value="9">111</option> <option value="10">110</option> <option value="11">32</option> <option value="12">109</option> </select> </li><li><label for="profile_birthdate_3i">Day</label><select id="profile_birthdate_3i" name="profile[birthdate(3i)]"> <option value="1">1</option> <option value="2">2</option> .......................... <option value="30">30</option> <option value="31">31</option> </select> plz have a look at year field (why ended at 2014?) and month (very strange - digits instead month names) :(
  • @alec-c4

    version
    justinfrench-formtastic (0.2.4)

    @grimen

    Question 1: "Why ended at 2014?"

    You can adjust this using Rails core options (e.g. :end_year):

    http://railsapi.com/doc/rails-v2.3.4/classes/ActionView/Helpers/DateHelper.html#M005680

    Question 2: Digits instead of month names...

    Passing this ball to Justin, I never seen such behavior and don't really got a qualified guess why right now. =S

    @justinfrench
    Owner

    Those months look really odd. Will look into it.

    @grimen

    Questions: 1. Are you using Globalize? 2. Have you tried to remove other plugins to see if behaviour still exists? Similar problems seems to be an issue with Globalize.

    @alec-c4

    1 - yes, i'm using globalize2
    2 - not yet

    @justinfrench
    Owner

    I just added a spec locally to ensure that this bug isn't in master, and the spec passed:

    it 'should use month name' do
      output_buffer.should have_tag('form li.date fieldset ol li select option', /^jan/i)
    end
    

    I'm closing this for now because it sounds like an incompatability, please feel free to re-open, or nag us on the Formtastic google group.

    @grimen

    I did that as well ^ xD

    @goodwill

    Not using globalize but still having this issue!

    I realize it happens on the built in I18n, but only when the locale is not :en.

    @grimen

    Not for me.

    @grimen

    Can you spec it?

    @goodwill

    Found out why already. Missing date time translations will cause this weird issue. I am using zh-TW locale.

    This issue was closed.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Something went wrong with that request. Please try again.