boulder-food-rescue / food-rescue-robot

A Rails App for Managing "Just in Time" Food Rescue, Developed by/for Boulder Food Rescue in Boulder, CO, USA
49 stars 56 forks source link

Add a DatePicker for Dates to prevent Invalid Dates #125

Open rylanb opened 7 years ago

rylanb commented 7 years ago

Expected Behavior

You cannot send invalid dates to the backend breaking the system with generic 500 error page.

Add a date-picker to make this easier to use and prevent invalid dates.

Actual Behavior

On views like /volunteers/region_admin you can pick dates from a drop-down. There is no validation to check that 6/31 shouldn't be entered and sent to the backend to do log / reporting lookups.

Steps to Recreate

  1. Go to a view that has you doing date lookups: (/logs/by_day?utf8=%E2%9C%93&date%5Bd%283i%29%5D=31&date%5Bd%282i%29%5D=6&date%5Bd%281i%29%5D=2017&commit=Go)
  2. You'll see an 'invalid date' error.
vidoseaver commented 7 years ago

Could use Date.is_valid?(year,month,day)

brandonbaker40 commented 6 years ago

@rylanb can I submit a PR for this?

rylanb commented 6 years ago

Surely! Just assign me when you do!