vendredi 29 août 2014

Why is my date out of range for some dates but not others?


Vote count:

0




I'm using bootstrap-datepicker-rails (v. 1.3.0.2) in my rails 4.0.9 project, and seeing some strange behavior with it in development and production, as the title explains. I've already had a look at this question, but it seems my issue is not the same, and more bizarre, than the OP's.


Like him, I'm getting an argument out of range error when I submit my form (whether it be for a create action or an update action), but only for some dates, and not for others.


For example, this date is out of range (copied from my development log - a snippet from the parameters sent to the controller):



"date_received"=>"08/28/2014"


Yet this date is OK:



"date_received"=>"08/07/2014"


I think the fact that some date selections save correctly rules out a formatting issue. I'm stumped as to how this could be happening. Any date before 08/13/2014 works, and any date after that returns the out of range error.


Here's the ugly details:


application.js:



//= require jquery
//= require jquery.turbolinks
//= require jquery.tablesorter
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-datepicker/core
//= require jquery-ui
//= require turbolinks


application.css:



*= require jquery-ui/theme
*= require bootstrap-datepicker
*= require font-awesome
*= require custom
*= require theme.blue
*= require_self


job.rb:


(validation for the field in question):



validates :date_received, presence: true


jobs_controller.rb:


(line that the error occurs on):



if @job.update_attributes(job_params)


job_params definition:



def job_params
params.require(:job).permit(:number, :name, :display_name, :date_received, :market,
:job_type, :pose_selection, :pose_selection_label, :pose_selection_deadline,
:pk_id, :pk, :flyout_id, :flyouts, :code, :tax_rate, :shipping_handling, :mail_home,
:mail_home_amount, :line, :notes, :entered, :entered_by, :verified, :verified_by,
:printed, :printed_by, :assembled_by, :shipped, :active, :discount_amount, :data)
end


Where do I go from here to troubleshoot this?



asked 1 min ago







Why is my date out of range for some dates but not others?

Aucun commentaire:

Enregistrer un commentaire