Skip to content

Commit 343abbc

Browse files
committed
fixup! fixup! fixup! fixup! Support for jsonformat in duration deserializer based on Duration::of(long,TemporalUnit). ref FasterXML#184
1 parent ea37ddc commit 343abbc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

datetime/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ times but are supported with this module nonetheless.
4747
[`LocalDateTime`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html), and
4848
[`OffsetTime`](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetTime.html), which cannot portably be converted to
4949
timestamps and are instead represented as arrays when `WRITE_DATES_AS_TIMESTAMPS` is enabled.
50+
* [`Duration`](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html), which unit can be configured in `JsonFormat` using a [`ChronoUnit`](https://docs.oracle.com/javase/8/docs/api/java/time/temporal/ChronoUnit.html) as `pattern`. For instance:
51+
```java
52+
@JsonFormat(pattern="MILLIS")
53+
long millis;
54+
55+
@JsonFormat(pattern="SECONDS")
56+
long seconds;
57+
58+
@JsonFormat(pattern="DAYS")
59+
long days;
60+
```
5061

5162
## Usage
5263

0 commit comments

Comments
 (0)