Skip to content
This repository has been archived by the owner on Jun 21, 2018. It is now read-only.

Commit

Permalink
make parse_date only work on Strings
Browse files Browse the repository at this point in the history
If the argument is not a String, the argument is returned.
Without this check, it was not possible any more to assign i.e.
Time.now to an attribute which has been calendar_date_attribute'ed.
With this check, only Strings are parsed, the rest is passed though.
  • Loading branch information
jbaehr authored and timcharper committed Nov 29, 2008
1 parent be505de commit d665832
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/calendar_date_select/calendar_date_select.rb
Expand Up @@ -78,6 +78,7 @@ def format_date(date)

# parses a date string using the specified format
def parse_date(date)
return date unless String===date
if has_time?(date)
hash = ::Date._strptime(date, date_format_string(true))
return nil if hash.nil?
Expand Down

0 comments on commit d665832

Please sign in to comment.