/** * This function returns a boolean indicating if a date is * valid by it's format. * * @param $date (Optional) A YDDate object, timestamp, array or string. * @param $format (Optional) The format name. Default: 'ISO'. * @param $family (Optional) If true, checks in all the format family. Default: true. * @param $empty (Optional) If false, empty dates are not valid. Default: true. * * @returns True if the date is valid, false otherwise. * * @static */ function isValid($date, $format = 'ISO', $family = true, $empty = true) { if (!YDDate::parse($date, $format, $family, false)) { return false; } if (!$empty && $date === YDDateFormat::getEmpty($format)) { return false; } return true; }