Take advantage of Liquid::Utils.to_date
This commit is contained in:
parent
7862f731b6
commit
c42eb7fc3a
|
@ -345,16 +345,9 @@ module Jekyll
|
||||||
|
|
||||||
private
|
private
|
||||||
def time(input)
|
def time(input)
|
||||||
case input
|
begin
|
||||||
when Time
|
Liquid::Utils.to_date(input).to_time
|
||||||
input.clone
|
rescue NoMethodError
|
||||||
when Date
|
|
||||||
input.to_time
|
|
||||||
when String
|
|
||||||
Time.parse(input) rescue Time.at(input.to_i)
|
|
||||||
when Numeric
|
|
||||||
Time.at(input)
|
|
||||||
else
|
|
||||||
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.localtime
|
||||||
|
|
Loading…
Reference in New Issue