Skip to content

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.
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