Skip to content

4.x: Return 'just now' for zero-second differences#500

Open
dereuromark wants to merge 1 commit into4.xfrom
add-just-now-diff
Open

4.x: Return 'just now' for zero-second differences#500
dereuromark wants to merge 1 commit into4.xfrom
add-just-now-diff

Conversation

@dereuromark
Copy link
Member

Summary

  • Returns "just now" instead of "0 seconds ago" when diffForHumans() is called on identical timestamps
  • Adds just_now translation string to Translator

Before / After

Before After
"0 seconds ago" "just now"
"0 seconds from now" "just now"
"0 seconds" (absolute) "just now"

Example

$now = Chronos::now();
echo $now->diffForHumans(); // "just now" (was "0 seconds ago")

Related

Inspired by Carbon's handling of zero-second differences. See briannesbitt/Carbon#3218.

When diffForHumans() is called on two identical timestamps, return
"just now" instead of the awkward "0 seconds ago".

This provides a more natural, human-readable output for edge cases
where two times are effectively the same.
@dereuromark dereuromark added this to the 3.next milestone Feb 7, 2026
@dereuromark dereuromark changed the base branch from 3.next to 4.x March 14, 2026 17:45
@dereuromark dereuromark modified the milestones: 3.next, 4.x Mar 14, 2026
@dereuromark dereuromark changed the title Return 'just now' for zero-second differences 4.x: Return 'just now' for zero-second differences Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant