end
end
+ def just_before_midnight(datetime)
+ if datetime.instance_of? DateTime
+ off = datetime.offset
+ else
+ off = Rational(datetime.utc_offset, 60*60*24)
+ end
+ return DateTime.new(datetime.year, datetime.month, datetime.day,
+ 23, 59, 59, off)
+ end
+
private
def enforce_constraints
+ # elections end just before midnight
+ self.enddate = just_before_midnight(self.enddate)
# kiosks can't be authenticated
self.authenticated = false if kiosk?
return true
end
end
-
-
<p><label for="election_enddate">Election End Date</label><br />
<font size="-1"><em>All elections end at 23:59.</em></font><br />
-<%= date_select :election, :enddate %></p>
+<%= datetime_select :election, :enddate, {:discard_hour=>true, :discard_minute=>true} %></p>
<p><label for="election_election_method">Election Method</label><br />
<% type_hash = {}; ELECTION_TYPES.each {|k,v| type_hash[v] = k} %>