Sorry if this is a dupe - I looked for the answer thoroughly and couldn't find anything that fit. :(
I'm pretty sure the issue is that my table start_date and end_date fields are datetime format, and datepicker is saving as string - but I can't figure out a way to fix that.
Here's my appointments.coffee script:
`$(document).ready(function() {
$('.datepicker')
.datepicker()
.on('changeDate', function(ev) {
$(this).datepicker('hide');
});
});`
My /app/views/appointments/_form.html.erb looks something like this:
<div id="drop-off">
<%= f.label :Drop_off %><br>
<%= f.text_field :start_date, :class => 'datepicker' %>
</div>
<div id="pick-up">
<%= f.label :Pick_up %><br>
<%= f.text_field :end_date, :class => 'datepicker' %>
</div>
Note: The data is getting passed to the server, but the dates are not writing to the database. When I view the output in firebug, it looks like something like this:
method
patch
appointment[bird_id]
1
appointment[cage_needed]
0
appointment[checkin]
0
appointment[customer_id]
1
appointment[end_date]
08/31/2015
appointment[notes]
appointment[start_date]
08/23/2015
appointment[user_id]
1
On another note: This worked when I first implemented it, but when I fixed the turbolinks issue (adding //= require jquery.turbolinks to application.js), it stopped saving to database (I think).
Ideas? Thanks!
EDIT: Selecting date in datepicker that is before August 12th 2015 will save to database, but anything after that will not.
EDIT 2: It turns out that it will save if the date is the 1st through the 12th of any month. If it is between the 13th and 30th/31st of the month, it won't save.