Skip to content

Commit

Permalink
Return date if date type
Browse files Browse the repository at this point in the history
  • Loading branch information
adzap committed Jan 6, 2016
1 parent 0f782a4 commit ad43eb3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/validates_timeliness/attribute_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ def write_timeliness_attribute(attr_name, value)
@timeliness_cache[attr_name] = value

if ValidatesTimeliness.use_plugin_parser
type = self.class.timeliness_attribute_type(attr_name)
timezone = :current if self.class.timeliness_attribute_timezone_aware?(attr_name)
value = Timeliness::Parser.parse(value, self.class.timeliness_attribute_type(attr_name), :zone => timezone)
value = Timeliness::Parser.parse(value, type, :zone => timezone)
value = value.to_date if value && type == :date
end

@attributes[attr_name] = value
Expand Down

0 comments on commit ad43eb3

Please sign in to comment.