time_ago_provider
用于生成模糊时间戳的库,例如(“9分钟前”)
- 星标
- 17
- 复刻
- 12
- 最近推送(UTC)
- 2023年10月6日
- 项目状态
- 未归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
time_ago_provider
library for generating fuzzy timestamp e.g("9 minutes ago")
import 'package:time_ago_provider/time_ago_provider.dart' as timeAgo;
void main() {
/// Default Format (summary of elapsed time)
final nineMinutesElapsed = DateTime.now().subtract(Duration(minutes: 9));
print(timeAgo.format(nineMinutesElapsed)); // 9 minutes ago
print(timeAgo.format(nineMinutesElapsed, locale: 'en_short')); // 9 min
/// Full Format (detailed elapsed time years, months, days...)
final longTimeElapsed = DateTime.now().subtract(Duration(days: 999, hours: 6, minutes: 8, seconds: 3));
print(timeAgo.formatFull(longTimeElapsed)); // 2 years, 9 months, 9 days, 6 hours, 8 minutes, 3 seconds
print(timeAgo.formatFull(longTimeElapsed, locale: 'en_short')); // 2 yr, 9 mo, 9 d, 6 h, 8 min, 3 sec
/// Adding new locales
timeAgo.setLocale('de', timeAgo.German());
timeAgo.setLocale('de_short', timeAgo.German(shortForm: true));
print(time_ago.format(nineMinutesElapsed, locale: 'de')); // vor 9 Minuten
print(timeAgo.format(nineMinutesElapsed, locale: 'de_short')); // 9 Min.
}
Supported Languages
- [x] ENGLISH
- [x] GERMAN
- [x] POLISH
- [x] FRENCH
- [x] ARABIC
- [x] TURKISH
- [x] PORTUGUESE
- [x] ITALIAN
- [x] SWEDISH
- [x] NORWEGIAN
- [x] PERSIAN
- [x] SPANISH
- More will be added
Installing
Contributors ✨
Thanks goes to these wonderful people!
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.
语言Dart
分类
使用的依赖
依赖清单 3 项
- flutter_coverage_badge开发依赖
^0.0.1+1 - flutter_lints开发依赖
^2.0.1 - test开发依赖
^1.16.5
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗