KPTimeAgo
CocoaPods 安装
将以下内容添加到您的 Podfile。
pod 'KPTimeAgo'
手动安装
只需将 KPTimeAgo 拖放到您的项目中。
使用方法
第一步 - import KPTimeAgo
into your project
let timeAgo = (Date().formatDateAsTimeAgo())
print(timeAgo)
//Just now
Other Example
//August 25 at 10:30 AM
//July 25
//September 25
//July 25, 2022
//October 25
//July 25, 2023
Custom date format
let timeAgo = KPTimeAgo.init(date: self.dateForComponents { $0.year = +6 }!, yesterdayFormat: nil, lastWeekFormat: nil, lastMonthFormat: nil, otherFormat: "LLLL d, yyyy")
print(timeAgo.formatDateAsTimeAgo()) //August 9, 2026
协作
您可以自由地就想法、问题或拉取请求进行协作。
联系方式
- Parth (https://github.com/parth0072)
- Twitter: @kshatriya_parth
- Email : Parth
许可证
KPTimeAgo 在 MIT 许可证下发布。