Zend Framework: Zend_Filter_Date Component Proposal
| Proposed Component Name | Zend_Filter_Date |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Filter_Date |
| Proposers | Thomas Weidner |
| Zend Liaison | TBD |
| Revision | 1.0 - 9 July 2009: Initial Draft. (wiki revision: 3) |
Table of Contents
1. Overview
Zend_Filter_Date is a filter which can convert a date string into another date format.
2. References
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will convert dates from a input format to a output format.
4. Dependencies on Other Framework Components
- Zend_Date
5. Theory of Operation
This filter accepts date input and will convert it to another date output. It can be used to simplify the date handling as it allows to convert a localized date into another localized date.
6. Milestones / Tasks
- Milestone 1: [DONE] Proposal finished
- Milestone 2: Proposal accepted
- Milestone 3: Coding finished
- Milestone 4: Unit tests finished
- Milestone 5: Documentation finished
- Milestone 6: Component moved to core
7. Class Index
- Zend_Filter_Date
8. Use Cases
| UC-01 |
|---|
Convert automatically based on the locale
| UC-02 |
|---|
Convert to a defined date format
| UC-03 |
|---|
Convert to a manually defined date format
9. Class Skeletons
Labels:
None
4 Comments
comments.show.hideAug 01, 2009
Ramon Henrique Ornelas
I like this proposal, because in my application I built a similar filter
code example
public function __construct( $formatOutput = 'yyyy-MM-dd' , $formatInput = 'dd/MM/yyyy' );
public function filter($input)
{
if( Zend_Date::isDate( $input , $this->getFormatInput() ) ){
$date = new Zend_Date( $input, $this->getFormatInput() );
return $date->get( $this->getFormatOutput() );
}
return $input;
}
Aug 02, 2010
Rob Allen
Would this component take an arbitrary input date like strtotime() can ?
Aug 03, 2010
Thomas Weidner
This does not depend on this proposal.
This is a feature which I want to add to Zend_Date 2.0.
But for now I have the problem that I can not localize most of these variants. (Note that 70% of the world do not speak english
).
Aug 03, 2010
Ryan Mauger
The CR Team advises that this proposal be approved, but would like to see this filter provide the option to return a Zend_Date object