[wp-trac] [WordPress Trac] #9272: Expand human_time_diff()'s abilities

WordPress Trac noreply at wordpress.org
Wed May 29 16:01:31 UTC 2013


#9272: Expand human_time_diff()'s abilities
-------------------------------------------------+-------------------------
 Reporter:  Viper007Bond                         |       Owner:
     Type:  enhancement                          |  Viper007Bond
 Priority:  normal                               |      Status:  new
Component:  Date/Time                            |   Milestone:  3.6
 Severity:  normal                               |     Version:  2.8
 Keywords:  has-patch needs-testing rtl-         |  Resolution:
  feedback westi-likes                           |
-------------------------------------------------+-------------------------

Comment (by Nessworthy):

 There is also an opportunity for consideration of specifics here.

 In [attachment:9272.3.patch], your expected result will always be in one
 unit of time.
 E.g. {{{9 hours}}} or {{{6 years}}}, and it doesn't get any more specific
 than that.

 What if an additional parameter was/additional paramteters were introduced
 to be able to dig down in to a more specific time period depending on what
 is passed?

 For example, depending on what you pass into it, if the time reaches
 years, it will return {{{5 years, 3 months}}}, but if it only stays in
 months, it will only return {{{5 months}}}.

 A third parameter, something like {{{$breakdown_as_array}}} could cause
 the function to return an array like:
 {{{
 Array (
     'years' => 5,
     'months' => 2,
     'days' => 15,
     'hours' => 3,
     'minutes' => 55,
     'seconds' => 10
 )
 }}}
 Just some food for thought. Although the last idea does take away the
 returned value from being immediately readable without using
 {{{implode()}}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/9272#comment:47>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list