zend-filter
zend-filter copied to clipboard
DateTimeFormatter: Add option to return invalid date string unfiltered
- add documentation for DateTimeFormatter. Addresses #58.
- add @todo notation in docblock for
$format
property - add tests for new option
- [x] Are you fixing a bug?
- [x] Detail how the bug is invoked currently.
$filter = new DateTimeFormatter();
$filter->filter('2013-31-31'); // throws exception
- [x] Detail the original, incorrect behavior.
DateTimeFormatter::filter
throws an exception in the event that the input is not a parsable date string - [x] Detail the new, expected behavior.
$filter = new DateTimeFormatter();
$filter->setThrowInvalidDateException(false);
$filter->filter('2013-31-31'); // returns "2013-31-31"
- [x] Base your feature on the
master
branch, and submit against that branch. - [x] Add a regression test that demonstrates the bug, and proves the fix.
- [x] Add a
CHANGELOG.md
entry for the fix.
@marcguyer This is a new feature because the exception was previously a desired result. Please use the develop
branch instead.
This repository has been closed and moved to laminas/laminas-filter; a new issue has been opened at https://github.com/laminas/laminas-filter/issues/2.
This repository has been moved to laminas/laminas-filter. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
- Squash all commits in your branch (
git rebase -i origin/{branch}
) - Make a note of all changed files (`git diff --name-only origin/{branch}...HEAD
- Run the laminas/laminas-migration tool on the code.
- Clone laminas/laminas-filter to another directory.
- Copy the files from the second bullet point to the clone of laminas/laminas-filter.
- In your clone of laminas/laminas-filter, commit the files, push to your fork, and open the new PR. We will be providing tooling via laminas/laminas-migration soon to help automate the process.