Validate date string (with Carbon)

	private function parse_date($str){
		$pattern = '/^([12]\d{3})[\/-]{1}(\d{1,2})[\/-]{1}(\d{1,2})$/';
		preg_match($pattern, $str, $matchs);
		if($matchs == false){
			$this->show_error($str . ' is not a valid date');
		}

		//Check year
		$now = Carbon::now();
		$year = $matchs[1];
		if($year < ($now->year - 3) || $year > ($now->year + 3)){
			$this->show_error('Year should be between ' . ($now->year - 3) . ' and ' . ($now->year + 3));
		}

		//Check month
		$month = $matchs[2];
		if($month < 1 || $month > 12){
			$this->show_error($str . ' is not a valid date');
		}

		//Check max day
		$m = Carbon::create($year, $month);
		$day = $matchs[3];
		if($day < 1 || $day > $m->daysInMonth){
			$this->show_error($str . ' is not a valid date');
		}

		$date = Carbon::create($year, $month, $day);
		return $date->toDateString();
	}