diff --git a/src/Legacy/Common.php b/src/Legacy/Common.php index 370de752..6d52b60a 100644 --- a/src/Legacy/Common.php +++ b/src/Legacy/Common.php @@ -106,15 +106,15 @@ protected function ymdTodmy($data = '') */ public function toTimestamp($input) { - /*$regex = '^(2[0-9][0-9][0-9])[-](0?[1-9]' + $regex = '^(2[0-9][0-9][0-9])[-](0?[1-9]' . '|1[0-2])[-](0?[1-9]' . '|[12][0-9]' - . '|3[01])T([0-9]|0[0-9]' - . '|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]-(00|01|02|03|04):00$'; + . '|3[01])T(0[0-9]' + . '|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9][-|+](00|01|02|03|04|05|06|07|08|09|10|11|12):00$'; if (!preg_match("/$regex/", $input)) { - return ''; - }*/ + return 0; + } return \DateTime::createFromFormat("Y-m-d\TH:i:sP", $input)->getTimestamp(); }