apie/dateformat-to-regex
Composer package of the apie library: dateformat to regex
Maintainers
1.0.0-RC2
2025-03-18 22:51 UTC
Requires
- php: >=8.3
- apie/core: 1.0.0-RC2
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.2
- phpunit/phpunit: ^11.5.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 48ad5261dd3de38c51f04ffb09f6bf282495f147
- Pieter Jordaan <pieter_jordaan.woop@hotmail.com>
This package is auto-updated.
Last update: 2026-05-31 00:24:43 UTC
README
dateformat-to-regex
👁 Latest Stable Version
👁 Total Downloads
👁 Latest Unstable Version
👁 License
👁 PHP Composer
This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo
Documentation
This package converts PHP date format strings into regular expressions. Right now it will create the 'simple' regular expression. So it will validate 30 february as a valid date.
Usage
<?php use Apie\DateformatToRegex\DateFormatToRegex; $dateFormat = DateTime::ATOM; $regularExpression = DateFormatToRegex::formatToRegex($dateFormat); $dateString = '2020-01-28T16:22:37-07:00'; // echos 1 as the regular expression matches the date string. var_dump(preg_match($regularExpression, $dateString));
