--[[
    Gets the os.date of specified os.time, and then returns a formatted string of human readable data. If no format is
    specified, the string will fall back on the default format. Create formats by appending os.date keys with $.
]]

function ReadableDate.fromTime(time, format)
	local output = format or DEFAULT_FORMAT
	local dateTable = os.date("*t", time)

	for type, amount in pairs(dateTable) do
		output = string.gsub(output, string.format("$%s", type), tostring(amount))
	end

	return output
end

return ReadableDate
