Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_View_Helper_TimeSince Component Proposal

Proposed Component Name Zend_View_Helper_TimeSince
Developer Notes
Proposers Geoffrey Tran (Google+)
Zend Liaison TBD
Revision 1.0 - 1 January 2008: Initial Draft. (wiki revision: 6)

Table of Contents

1. Overview

This helper calculates the time passed from timestamps to generate a formatted string like "5 days and 4 hours". Applications of this helper are generally seen in "Created 2 weeks ago" or "Last modified 5 minutes ago" type lines.

Units supported are years, months, weeks, days, minutes, seconds. String format is the largest possible unit and if possible the unit below it. If a 1 year and 2 weeks have passed then "1 year" is the output; however, if 1 year, 2 months and 5 days have passed then "1 year and 2 months" is returned. If less than a second have passed then "less than a second" is returned.

Output is automatically translated if possible using Zend_View_Helper_Translate. The translation format is '%d months'. An already completed gettext pot file is located on Zym's demo in the data locale folder.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will extend Zend_View_Helper_Abstract
  • This component will allow the use of translation
  • This component will format a date using a timestamp

4. Dependencies on Other Framework Components

  • Zend_View_Helper_Abstract
  • Zend_View_Helper_Translate

5. Theory of Operation

Calculates time passed since a specified time.

6. Milestones / Tasks

  • Milestone 1: [DONE] Proposal creation
  • Milestone 2: [DONE] Working Code, Documentation, Tests
  • Milestone 3: Working prototype checked into the incubator.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_View_Helper_TimeSince

8. Use Cases


9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 19, 2009

    <p>Requesting community feedback.</p>

  2. Feb 26, 2009

    <p>*) Translation is with the actual class skeleton not possible as you can't define when to return a translateable string and when an normal string.</p>

    <p>*) Units could automatically be translated... it's all available within ZF. No need to let the user alone with this task.</p>

    <p>*) You should also accept input of Zend_Date and Datestring.</p>

  3. Feb 26, 2009

    <p>+1 <ac:emoticon ac:name="smile" /></p>

  4. Feb 26, 2009

    <p>It seems useful... To get times a la Facebook.. I wiould use it.</p>

  5. Mar 03, 2009

    <p>Good idea, it would be nice to have the pattern string translatable. Zend_Translate instance would be used with Zend_Registry::get('Zend_Translate') like is it in Zend_Validate_Abstract.</p>

    1. Mar 03, 2009

      <p>That's not enough. You must also be able to set the instance manually to override the application wide locale setting (key Zend_Locale) and also to set the instance manually when no set key is available.</p>

      1. Mar 03, 2009

        <p>yes I agree, it should allow all of those.</p>

  6. Mar 25, 2009

    <p>Good job! Looks better then my <a class="external-link" href=""></a> <ac:emoticon ac:name="smile" /></p>

  7. Mar 25, 2009

    <p>It may be good to provide some translations out-of-box.</p>

  8. Jul 14, 2009

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Framework Approval</ac:parameter><ac:rich-text-body>
    <p>This proposal is accepted for immediate development in the Standard Incubator,<br />
    with the following criteria:</p>
    <li>Allow passing Zend_Date and DateTime objects</li>
    <li>Use existing i18n and l10n components for translating units</li>