time_ago_provider 1.0.0
time_ago_provider: ^1.0.0 copied to clipboard
A Library that takes a time stamp value and returns an interval String of the time that passed between the given time stamp to the present. e.g("7 minutes ago" ).
A Library that takes a time stamp value and returns an interval String of the time that passed between the given time stamp to the present (Now). (e.g. "7 minutes ago" ).
Usage #
Easy Lazy! Feed it timeStamp, produces you time ago.
import 'package:time_ago_provider/time_ago_provider.dart';
void main()
{
//Normal Usage
//1- Get the current time stamp
int timeStamp = DateTime.now().millisecondsSinceEpoch;
//2- getTimeAgo(int timeStamp) returns a String " X minutes/hours/days/months/years ago ...
String timeAgo = TimeAgo.getTimeAgo(timeStamp);
print("Posted $timeAgo"); // Posted just now
//With Language [DEFAULT = English]
int germanTimeStamp = DateTime.now().millisecondsSinceEpoch;
String germanTimeAgo = TimeAgo.getTimeAgo(germanTimeStamp, language: Language.GERMAN);
print("Gepostet $germanTimeAgo");
}
Methods #
Function | Parameter | Description | Return |
---|---|---|---|
getTimeAgo | int timeStamp |
Returns an interval String of the time that passed between the given time stamp to the present | String timeAgo |
Supported Languages #
- ✅ ENGLISH
- ✅ ARABIC
- ✅ GERMAN
- ✅ SPANISH
- ✅ CHINESE
- ✅ RUSSIAN
- ✅ PORTUGUESE
- ✅ JAPANESE
- ✅ HINDI
- ✅ FRENCH
Installing #
Features and bugs #
If you face any problems feel free to open an issue at the issue tracker. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.