Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A library to format dates as described in Material Design guidelines.

License

Notifications You must be signed in to change notification settings

Applib-HarmonyOS/NaturalDateFormat

Repository files navigation

.github/workflows/main.yml Quality Gate Status

NaturalDateFormat

A HMOS library to format dates.

Source

Inspired by ZieIony/NaturalDateFormat

Feature

This library provides feature to format dates. RelativeDateFormat formats date as relative (4 months ago, today, next year), AbsoluteDateFormat formats date as absolute (Monday, 4:32 PM, June 10). This library internally uses Joda Time "joda-time:joda-time:2.9.4".

Dependency

  1. For using naturaldateformat module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
	dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
 testImplementation 'junit:junit:4.13'
 ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
 implementation project(path: ':naturaldateformat')
 }
  1. For using naturaldateformat in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
	dependencies {
 implementation fileTree(dir: 'libs', include: ['*.jar'])
 testImplementation 'junit:junit:4.13'
 compile 'joda-time:joda-time:2.9.4'
 }
  1. For using naturaldateformat from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
 dependencies {
 implementation ('dev.applibgroup:naturaldateformat:1.0.0') 
	 testCompile 'junit:junit:4.13'
 }

Usage

Java

RelativeDateFormat relFormat = new RelativeDateFormat(context,NaturalDateFormat.DATE);
AbsoluteDateFormat absFormat = new AbsoluteDateFormat(context,NaturalDateFormat.DATE | NaturalDateFormat.HOURS | NaturalDateFormat.MINUTES);
relFormat.format(new Date().getTime());
absFormat.format(new Date().getTime());

About

A library to format dates as described in Material Design guidelines.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

Languages

AltStyle によって変換されたページ (->オリジナル) /