mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-13 01:10:39 -07:00
feat: Support two date formats: ISO 8601 and the standard US date format
used in google sheets
This commit is contained in:
parent
03349b0ed5
commit
d6735d449d
6 changed files with 45 additions and 23 deletions
|
|
@ -48,13 +48,11 @@ class SurveyItemValues
|
|||
def recorded_date
|
||||
@recorded_date ||= begin
|
||||
recorded_date = value_from(pattern: /Recorded\s*Date/i)
|
||||
puts recorded_date
|
||||
date = nil
|
||||
begin
|
||||
date = Date.parse(recorded_date)
|
||||
rescue StandardError => e
|
||||
date = Date.strptime(recorded_date, "%m/%d/%Y")
|
||||
end
|
||||
date = if recorded_date.include?("T")
|
||||
Date.parse(recorded_date)
|
||||
else
|
||||
Date.strptime(recorded_date, "%m/%d/%Y")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue