ilkersevim_relative_time 0.1.3 copy "ilkersevim_relative_time: ^0.1.3" to clipboard
ilkersevim_relative_time: ^0.1.3 copied to clipboard

Show compact chat and feed timestamps such as 3d, 2h, 5m, and now with one dependency-free Dart formatter.

ilkersevim_relative_time #

Short relative-time labels for chat-style timestamps (3d, 2h, 5m, now). Dependency-free beyond the Dart SDK.

Why use this package? #

  • Keep compact timestamps consistent across chat, activity, and feed views.
  • Avoid adding a localization or date-formatting dependency for four short relative labels.
  • Inject now for deterministic tests and server-aligned clocks.

License: Apache-2.0. Issues: github.com/redjadet/ilkersevim_relative_time/issues.

Installation #

dependencies:
  ilkersevim_relative_time: ^0.1.2

Requires Dart >=3.12.0.

Usage #

import 'package:ilkersevim_relative_time/ilkersevim_relative_time.dart';

final String label = formatRelativeTimeShort(messageTime);
// or with a fixed reference:
final String fixed = formatRelativeTimeShort(messageTime, now: DateTime.now());

API #

  • formatRelativeTimeShort(DateTime time, {DateTime? now})String
1
likes
160
points
374
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Show compact chat and feed timestamps such as 3d, 2h, 5m, and now with one dependency-free Dart formatter.

Repository (GitHub)
View/report issues

Topics

#datetime #formatting #dart

License

Apache-2.0 (license)

More

Packages that depend on ilkersevim_relative_time