Class: OAI::Provider::Response::Base
- Inherits:
-
Object
- Object
- OAI::Provider::Response::Base
show all
- Defined in:
- backend/app/lib/oai/oai_gem_patches/date_parse_timezone_fix.rb
Instance Method Summary
collapse
Instance Method Details
#parse_date(value) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'backend/app/lib/oai/oai_gem_patches/date_parse_timezone_fix.rb', line 3
def parse_date(value)
return value if value.respond_to?(:strftime)
Date.parse(value)
parsed = Time.parse(value)
if parsed.utc_offset != 0
offset = parsed.utc_offset
parsed.utc + offset
else
parsed
end
rescue
raise OAI::ArgumentException.new, "unparsable date: '#{value}'"
end
|