1 | <?php |
||
6 | class DateValidation |
||
7 | { |
||
8 | const FORMAT_SIMPLE = 'Y-m-d'; |
||
9 | const FORMAT_RFC3339 = \DateTime::RFC3339; |
||
10 | |||
11 | /** |
||
12 | * Valid against Y-m-d format |
||
13 | * @param string $dateString String to validate |
||
14 | * @return bool |
||
15 | */ |
||
16 | public function isDateValid(string $dateString): bool |
||
33 | |||
34 | public function isDateTimeValid(string $dateString): bool |
||
51 | |||
52 | /** |
||
53 | * @return \DateTime|false |
||
54 | */ |
||
55 | public function createDateFromString(string $dateString) |
||
59 | |||
60 | /** |
||
61 | * @return \DateTime|false |
||
62 | */ |
||
63 | public function createDateTimeFromString(string $dateString) |
||
67 | |||
68 | private function isValidDateAgainstRegex($string): bool |
||
76 | |||
77 | private function isValidDateTimeAgainstRegex($string): bool |
||
85 | } |
||
86 |