Skip to content

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

Merged
dereuromark merged 1 commit into4.xfrom
add-just-now-diff
Mar 26, 2026
Merged

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

Conversation

@dereuromark
Copy link
Copy Markdown
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
@dereuromark dereuromark requested review from ADmad March 26, 2026 11:12
@dereuromark dereuromark merged commit 1bafb4c into 4.x Mar 26, 2026
8 checks passed
@dereuromark dereuromark deleted the add-just-now-diff branch March 26, 2026 11:26
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.

2 participants