From 7441f13d6b59354b9f4a888db4264d6d57f13a6e Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Wed, 19 Sep 2018 08:40:27 +0100 Subject: [PATCH] Sometimes date fields have values that aren't dates Like "Not available" in Greenwich. --- lib/uk_planning_scraper/idox.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/uk_planning_scraper/idox.rb b/lib/uk_planning_scraper/idox.rb index 30b3426..17eeac8 100644 --- a/lib/uk_planning_scraper/idox.rb +++ b/lib/uk_planning_scraper/idox.rb @@ -129,11 +129,11 @@ module UKPlanningScraper when 'Planning Portal Reference' app[:alternative_reference] = value when 'Application Received' - app[:date_received] = Date.parse(value) if value != '' + app[:date_received] = Date.parse(value) if value.match(/\d/) when 'Application Registered' - app[:date_received] = Date.parse(value) if value != '' + app[:date_received] = Date.parse(value) if value.match(/\d/) when 'Application Validated' - app[:date_validated] = Date.parse(value) if value != '' + app[:date_validated] = Date.parse(value) if value.match(/\d/) when 'Address' app[:address] = value when 'Proposal' @@ -143,7 +143,7 @@ module UKPlanningScraper when 'Decision' app[:decision] = value when 'Decision Issued Date' - app[:date_decision] = Date.parse(value) if value != '' + app[:date_decision] = Date.parse(value) if value.match(/\d/) when 'Appeal Status' app[:appeal_status] = value when 'Appeal Decision'