Skip to content

Commit

Permalink
Try Time.new(string, in: 0) for parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jul 27, 2024
1 parent 70de71c commit 2e0a4cc
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/db/postgres/native/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,7 @@ def parse(string)
return string
end

if match = string.match(/\A(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+(?:\.\d+)?)([-+]\d\d(?::\d\d)?)?\z/)
parts = match.captures

parts[5] = Rational(parts[5])

if parts[6].nil?
parts[6] = '+00'
end

return Time.new(*parts)
end
return Time.new(string, in: 0)
end
end

Expand Down

0 comments on commit 2e0a4cc

Please sign in to comment.