Skip to content

Commit

Permalink
Merge pull request #25 from velimovich/mv-fix-datetime-oid-for-nil-value
Browse files Browse the repository at this point in the history
Allow to pass nil value to DateTime field
  • Loading branch information
PNixx authored Apr 13, 2020
2 parents 2ed6a4a + 1dc4a80 commit cc29c64
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DateTime < Type::DateTime # :nodoc:

def serialize(value)
value = super
return unless value
return value.strftime('%Y-%m-%d %H:%M:%S') unless value.acts_like?(:time)

value.to_time.strftime('%Y-%m-%d %H:%M:%S')
Expand Down

0 comments on commit cc29c64

Please sign in to comment.