Take advantage of Liquid::Utils.to_date

This commit is contained in:
Pat Hawks 2016-12-22 14:39:08 -06:00
parent 7862f731b6
commit c42eb7fc3a
1 changed files with 3 additions and 10 deletions

View File

@ -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