module Jekyll::Utils
def parse_date(input, msg = "Input could not be parsed.")
Returns the parsed date if successful, throws a FatalException
msg - (optional) the error message to show the user
input - the date/time to parse
Parse a date/time and throw an error if invalid
def parse_date(input, msg = "Input could not be parsed.") @parse_date_cache ||= {} @parse_date_cache[input] ||= Time.parse(input).localtime rescue ArgumentError raise Errors::InvalidDateError, "Invalid date '#{input}': #{msg}" end