Make WordPress Core

Opened 11 years ago

Closed 7 years ago

#35655 closed enhancement (fixed)

Add seconds to human_time_diff()

Reported by: johnjamesjacoby Owned by: pento
Priority: normal Milestone: 5.3
Component: Formatting Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description (last modified by johnjamesjacoby)

When using human_time_diff() any difference less than 1 minute will appear as:

  • 1 min

Disregarding that "min" should probably be "minutes", I propose we add support for seconds, using the MINUTE_IN_SECONDS constant.

This could be:

  • 1 second
  • 2 seconds
  • or even less than 1 minute

Attachments (2)

35655.1.patch​ (621 bytes ) - added by johnjamesjacoby 11 years ago.
35655.diff​ (1.3 KB ) - added by pento 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @johnjamesjacoby
11 years ago

  • Description modified (diff)

#2 @johnjamesjacoby
11 years ago

  • Keywords has-patch 2nd-opinion added; needs-patch removed

@pento
7 years ago

#4 @pento
7 years ago

  • Keywords 2nd-opinion removed
  • Milestone → 5.3
  • Owner set to pento
  • Status new → assigned
  • Type defect (bug) → enhancement

#5 @pento
7 years ago

  • Keywords has-unit-tests added

#6 @pento
7 years ago

35655.diff​ Refreshes the original patch and adds a unit test.

#7 @pento
7 years ago

  • Resolution → fixed
  • Status assigned → closed

In 45573:

Formatting: Add support for seconds to human_time_diff().

The web has gotten so much faster since human_time_diff() was created, we need to be able to measure time differences with much finer granularity. Now, we can.

Props johnjamesjacoby, pento.
Fixes #35655.

Note: See TracTickets for help on using tickets.