Make WordPress Core

Opened 8 years ago

Closed 5 years ago

#35655 closed enhancement (fixed)

Add seconds to human_time_diff()

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

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 8 years ago.
35655.diff (1.3 KB) - added by pento 5 years ago.

Download all attachments as: .zip

Change History (9)

#1 @johnjamesjacoby
8 years ago

  • Description modified (diff)

#2 @johnjamesjacoby
8 years ago

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

#3 @swissspidy
8 years ago

See also: #29849

5 years ago

#4 @pento
5 years ago

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

#5 @pento
5 years ago

  • Keywords has-unit-tests added

#6 @pento
5 years ago

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

#7 @pento
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to 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.