Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Haraldsen committed Jan 22, 2024
1 parent 6637a98 commit a1dd74d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Test {
```

### Handle different granularity (ISO format)
Validate to different required granularity:
#### Validate with specified granularity
```java
import com.ethlo.time.ITU;
import com.ethlo.time.TemporalType;
Expand All @@ -120,7 +120,7 @@ class Test {
}
```

Allowing handling different levels of granularity:
#### Handling different levels of granularity explicitly
```java
import com.ethlo.time.ITU;
import com.ethlo.time.TemporalHandler;
Expand All @@ -147,7 +147,20 @@ class Test {
});
}
}
```
#### Parsing leniently to a timestamp
In some real world scenarios, the need to parse a best-effort timestamp is needed. To ease this, we can use `ITU.parseLenient()` with `DateTime.toInstant()` like this:

```java
import com.ethlo.time.ITU;
import com.ethlo.time.TemporalHandler;
import java.time.temporal.TemporalAccessor;

class Test {
void parseTest() {
final Instant instant = ITU.parseLenient("2017-12-06").toInstant();
}
}
```

## Q & A
Expand Down

0 comments on commit a1dd74d

Please sign in to comment.