mirror of
https://github.com/jekyll/jekyll.git
synced 2026-01-31 01:38:24 -05:00
Check return value of to_date
This commit is contained in:
@@ -347,12 +347,12 @@ module Jekyll
|
||||
|
||||
private
|
||||
def time(input)
|
||||
begin
|
||||
Liquid::Utils.to_date(input).to_time
|
||||
rescue NoMethodError
|
||||
date = Liquid::Utils.to_date(input)
|
||||
unless date.respond_to?(:strftime)
|
||||
raise Errors::InvalidDateError,
|
||||
"Invalid Date: '#{input.inspect}' is not a valid datetime."
|
||||
end.localtime
|
||||
end
|
||||
date.to_time.localtime
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user