I have jsonb column in my Postgres db and i have a form with pref["date"] date_field for user.
How I can convert to date and validate user.pref["date"] that is date without error if convert to date will falls?
You can rescue exception for invalid date conversion and add error then
begin
date = Date.parse(pref['date'])
rescue ArgumentError
# add error for invalid date
end