Skip to content

use native-time-ago#61

Open
chinesepowered wants to merge 1 commit intohustcc:masterfrom
chinesepowered:use-native-time
Open

use native-time-ago#61
chinesepowered wants to merge 1 commit intohustcc:masterfrom
chinesepowered:use-native-time

Conversation

@chinesepowered
Copy link

Summary

This PR replaces timeago.js with native-time-ago, a zero-dependency library that uses the native Intl.RelativeTimeFormat API.
Benefits:

  • ✅ Zero dependencies (no more locale files to bundle)
  • ✅ Supports 100+ languages automatically via browser's native API
  • ✅ Translations improve as browsers update (no maintenance needed)
  • ✅ Smaller bundle size - no need to ship locale dictionaries

Changes:

  • Replaced timeago.js dependency with native-time-ago@1.0.1
  • Updated component to use Intl.RelativeTimeFormat with numeric: 'auto' for natural strings like "yesterday" instead of "1 day ago"
  • Auto-update interval set to 60 seconds

Migration: The API is nearly identical - existing usage like works the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant