Skip to content

cyzaoj/TimeAgo

Repository files navigation

TimeAgo - An Android TimeAgo Library, now in Kotlin!

class: LocalDate LocalDateTime Date support time ago.

Platform Download API license


##DEMO



Configure

Maven

<dependency>
  <groupId>com.aboust</groupId>
  <artifactId>time_ago</artifactId>
  <version>${latestVersion}</version>
  <type>pom</type>
</dependency>

JCenter

First. add to project build.gradle

repositories {
    jcenter()
}

Second. add to module build.gradle

implementation "com.aboust:time_ago:${latestVersion}"

Usage

####First. coding in kotlin:

  Date().timeAgo(context)
  
  Build.VERSION.SDK_INT >= Android Q:

  LocalDateTime.now().timeAgo(context)
  LocalDate.now().timeAgo(context)
        

####Second. edit strings.xml (Optional) 如果不配置values/strings.xml相应配置默认为英文

<string name="ago">前</string>
<string name="milliseconds">毫秒</string>
<string name="minute">1分钟</string>
<string name="minutes">分钟</string>
<string name="seconds">秒</string>
<string name="second">1秒</string>
<string name="hour">1小时</string>
<string name="hours">小时</string>
<string name="just_now">刚刚</string>
<string name="week">1星期</string>
<string name="last_week">最后1星期</string>
<string name="weeks">星期</string>
<string name="month">1个月</string>
<string name="months">个月</string>
<string name="months">个月</string>
<string name="last_month">最后1月</string>
<string name="year">1年</string>
<string name="last_year">最后1年</string>
<string name="years">年</string>
<string name="yesterday">昨天</string>
<string name="day">1天</string>
<string name="days">天</string>

About

An Android Time Ago Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages