From 818a00fac0f353d7c0083c2448ead84bbac949e8 Mon Sep 17 00:00:00 2001 From: Morten Haraldsen Date: Thu, 31 Mar 2022 09:48:14 +0200 Subject: [PATCH] Update README.md --- README.md | 60 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index a6fe233..2501a69 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ Add dependency ``` +Below you find some samples of usage of this library. Please check out the [javadoc](https://javadoc.io/doc/com.ethlo.time/itu/latest/com/ethlo/time/ITU.html) for more details. + + ```java import java.time.OffsetDateTime; import com.ethlo.time.DateTime; @@ -64,7 +67,6 @@ final String formattedMicro = ITU.formatUtcMicro(dateTime); // 2012-12-27T22:07: // Parse lenient, raw data final DateTime dateTime = ITU.parse("2012-12-27T19:07Z"); - ``` ### Handle leap-seconds @@ -82,6 +84,31 @@ catch (LeapSecondException exc) } ``` +### Handle different granularity (ISO format) +Validate to different required granularity: +```java +ITU.isValid("2017-12-06", TemporalType.LOCAL_DATE_TIME); +``` + +Allowing handling different levels of granularity: +```java +return ITU.parse("2017-12-06", new TemporalHandler<>() +{ + @Override + public OffsetDateTime handle(final LocalDate localDate) + { + return localDate.atTime(OffsetTime.of(LocalTime.of(0, 0), ZoneOffset.UTC)); + } + + @Override + public OffsetDateTime handle(final OffsetDateTime offsetDateTime) + { + return offsetDateTime; + } +}); +``` + + ## Q & A *Why this little project?* @@ -149,10 +176,13 @@ instead of `60`. ## Changelog ### Version 1.7.0 + +2022-09-03 + * Added support for keeping number of significant fraction digits in second * Added toString methods to `DateTime` for formatting. * Added support for formatting date-times with other time-offsets than UTC. -* Vastly improved javadoc. +* Vastly [improved javadoc](https://javadoc.io/doc/com.ethlo.time/itu/latest/com/ethlo/time/ITU.html). ### Version 1.6.1 @@ -160,28 +190,8 @@ instead of `60`. New helper methods were added to deal with different granularity. -Validate to different required granularity: -```java -ITU.isValid("2017-12-06", TemporalType.LOCAL_DATE_TIME); -``` - -Allowing handling different levels of granularity: -```java -return ITU.parse("2017-12-06", new TemporalHandler<>() -{ - @Override - public OffsetDateTime handle(final LocalDate localDate) - { - return localDate.atTime(OffsetTime.of(LocalTime.of(0, 0), ZoneOffset.UTC)); - } - - @Override - public OffsetDateTime handle(final OffsetDateTime offsetDateTime) - { - return offsetDateTime; - } -}); -``` +* Validate to different required granularity. +* Allowing handling different levels of granularity. ### Version 1.6.0 @@ -240,4 +250,4 @@ Support for space as date/time separator for parsing, as specified as optional i 2017-02-27 -Initial release. \ No newline at end of file +Initial release.