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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:50:26+00:00 2026-06-18T01:50:26+00:00

My ‘Events’ table has 2 datetime values to store start and finish dates. They

  • 0

My ‘Events’ table has 2 datetime values to store start and finish dates.

They used to be like this

.field
    = f.label t :event_start_date
    %br
    = f.datetime_select :start_date
  .field
    = f.label t :event_finish_date
    %br
    = f.datetime_select :finish_date

I used the datetime picker addon and it works fine visually. However, since the fields changed from datetime_select to text_field, the values are not stored when a new event is created.

This is how it looks right now:

.field
    = f.label t :event_start_date
    %br
    = f.text_field :start_date, :class=>"datetime_box", :size=>"17"
  .field
    = f.label t :event_finish_date
    %br
    = f.text_field :finish_date, :class=>"datetime_box", :size=>"17"

And this is the js in case anyone needs it:

$(function() {
    $('.datetime_box').datetimepicker({
            minDate: new Date(),
            showOn: "button",
            buttonImage: "../images/pais_vasco_conciertos_teatro_musica_grupos.png",
            buttonImageOnly: true
    });
});

Any idea how to overcome this problem and store the values?

Events controller

def create

    categories = params[:category_ids] or []
    @event = Event.new(params[:event].merge(:user_id => current_user.id, :category_ids => categories))

    respond_to do |format|
      if @event.save

        #Mailer to seek appoval
        format.html { redirect_to @event, notice: 'Event was successfully created.' }
        format.json { render json: @event, status: :created, location: @event }
      else
        format.html { render action: "new" }
        format.json { render json: @event.errors, status: :unprocessable_entity }
      end
    end
  end

This site works in 4 languages. This error only shows up under English language. So, I guess it has to do with the format..

Examples of format:
Spanish and French (works)

"start_date"=>"30/01/2013 16:39",
 "finish_date"=>"31/01/2013 16:39",

Basque(works)

"start_date"=>"2013/01/30 16:38",
 "finish_date"=>"2013/01/31 16:38",

English(does NOT work)

How can I make that MM/DD/YY work? Thanks again

"start_date"=>"01/30/2013 16:40",
 "finish_date"=>"01/31/2013 16:40",
  • 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-18T01:50:28+00:00Added an answer on June 18, 2026 at 1:50 am

    You need to make sure that the date, as a string, that is passed to the controller can be parsed by ruby. One way to do this is to pass a date and time format to datetimepicker. Experiment what format suits your needs and what can be parsed by ruby.

    Try adding these options and see if that fixes your issue

    $(elem).datetimepicker({
      dateFormat: 'M d, yy',
      timeFormat: 'hh:mm tt'
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
This is how I get the tags of a body of text. var tags
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Hi if i run my project its indicate this logcat error...how to solve this
Does anyone know how can I replace this 2 symbol below from the string
The problem with unsigned char. I am reading a PPM image file which has
I would like to count the length of a string with PHP. The string
I have just tried to save a simple *.rtf file with some websites and
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

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.