Problem/Motivation

The DateFormatter::formatInterval method can handle 7 different levels of granularity. One per datetime unit.

  1. year
  2. month
  3. week
  4. day
  5. hour
  6. min
  7. sec

However, the TimeAgo formatter limits this option to 6 by some reason.

Steps to reproduce

  1. Add timestamp field to some content type.
  2. Set the granularity formatter setting to max allowed value which is 6.
  3. Create a node and set the timestamp value to some date far in the past.
  4. Notice that the rendered interval does not include seconds.

Proposed resolution

Increase max allowed granularity in Time ago formatter by one.

Issue fork drupal-3411922

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Chi created an issue. See original summary.

chi’s picture

Issue summary: View changes

pradhumanjain2311 made their first commit to this issue’s fork.

pradhumanjain2311’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Think we should be able to extend some test coverage somewhere for this.

Tanuj. made their first commit to this issue’s fork.

tanuj.’s picture

Status: Needs work » Needs review
dishakatariya’s picture

Assigned: Unassigned » dishakatariya
dishakatariya’s picture

Assigned: dishakatariya » Unassigned
divya.sejekan’s picture

Assigned: Unassigned » divya.sejekan
divya.sejekan’s picture

Assigned: divya.sejekan » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new90.3 KB
new109.01 KB
new202.48 KB
new139.73 KB

Tested using - MR!6085
The issue is fixed.

Testing steps :
Steps to reproduce
Add timestamp field to some content type.
Set the granularity formatter setting to max allowed value which is 6.
Create a node and set the timestamp value to some date far in the past.
Notice that the rendered interval does not include seconds.

Can Be Moved to RTBC++

smustgrave’s picture

@Tanuj same deal as the other one, this was tagged for a novice user to get started. Based on your post history you should be able to work on non novice issues

tanuj.’s picture

hey sure @smustgrave will keep that in mind. thanks

  • longwave committed dfe15ca8 on 11.x
    Issue #3411922 by pradhumanjain2311, Tanuj., divya.sejekan, Chi,...
longwave’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Committed dfe15ca and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.