Check return value of `to_date`
This commit is contained in:
parent
2eb8469936
commit
f7edcceb70
|
@ -347,12 +347,12 @@ module Jekyll
|
||||||
|
|
||||||
private
|
private
|
||||||
def time(input)
|
def time(input)
|
||||||
begin
|
date = Liquid::Utils.to_date(input)
|
||||||
Liquid::Utils.to_date(input).to_time
|
unless date.respond_to?(:strftime)
|
||||||
rescue NoMethodError
|
|
||||||
raise Errors::InvalidDateError,
|
raise Errors::InvalidDateError,
|
||||||
"Invalid Date: '#{input.inspect}' is not a valid datetime."
|
"Invalid Date: '#{input.inspect}' is not a valid datetime."
|
||||||
end.localtime
|
end
|
||||||
|
date.to_time.localtime
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue