summaryrefslogtreecommitdiffstats
path: root/lib/registration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/registration.rb')
-rw-r--r--lib/registration.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/registration.rb b/lib/registration.rb
index bfcf903..4f2db17 100644
--- a/lib/registration.rb
+++ b/lib/registration.rb
@@ -32,8 +32,15 @@ def create_pdf_file_name(band)
filename = "#{Date.today.iso8601}-#{sanitize(band.name)}-#{sanitize(band.city)}.pdf"
end
+def parse_date(str)
+ Date.parse(str)
+rescue TypeError => e
+ $stderr << "Invalid date specified: " << str
+ raise
+end
+
def accept_registrations(settings)
- start_date = Date.parse(settings.accept_registrations[:start])
- end_date = Date.parse(settings.accept_registrations[:stop])
+ start_date = parse_date(settings.accept_registrations[:start])
+ end_date = parse_date(settings.accept_registrations[:stop])
start_date <= Date.today && end_date > Date.today
end