|
|
|
@ -121,10 +121,8 @@ class LocationsController < ApplicationController |
|
|
|
day = location_params["startdate(3i)"] |
|
|
|
day = location_params["startdate(3i)"] |
|
|
|
month = location_params["startdate(2i)"] |
|
|
|
month = location_params["startdate(2i)"] |
|
|
|
year = location_params["startdate(1i)"] |
|
|
|
year = location_params["startdate(1i)"] |
|
|
|
if [day, month, year].none?(&:blank?) && Date.valid_date?(year.to_i, month.to_i, day.to_i) |
|
|
|
@location.startdate = if [day, month, year].none?(&:blank?) && Date.valid_date?(year.to_i, month.to_i, day.to_i) |
|
|
|
@location.startdate = Time.zone.local(year.to_i, month.to_i, day.to_i) |
|
|
|
Time.zone.local(year.to_i, month.to_i, day.to_i) |
|
|
|
else |
|
|
|
|
|
|
|
@location.startdate = nil |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
if @location.save(context: :startdate) |
|
|
|
if @location.save(context: :startdate) |
|
|
|
redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route]) |
|
|
|
redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route]) |
|
|
|
|