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 ↗