(note: continuation of [modules-java8#374)(https://github.com/FasterXML/jackson-modules-java8/issues/374))
Existing features
DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS
SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
allow changing unit-of-time associated with numeric (JSON Number) timestamps b/w milliseconds (false) and nanoseconds (true), in cases where Time value has granularity beyond milliseconds.
As a consequence, when disabled, precision is truncated to millisecond resolution.
These settings have no effect on textual (JSON String) representations, however.
It would be useful to have explicit features -- for this module, that'd be JavaTimeFeature (in 2.x -- in 3.x it'd be databind's new DateTimeFeature) -- like:
JavaTimeFeature.TRUNCATE_TO_MSECS_ON_READ
JavaTimeFeature.TRUNCATE_TO_MSECS_ON_WRITE
which would:
TRUNCATE_TO_MSECS_ON_READ enabled: after reading Time value, clear nanoseconds part before returning to caller (affects Numeric timestamps too)
TRUNCATE_TO_MSECS_ON_WRITE enabled: before writing Time value, clear nanoseconds part
These would alongside but independent @JsonFormat(pattern = ) configuration.
Due to plans for 2.x vs 3.x, this should only be considered for 3.x (3.1).
(note: continuation of [modules-java8#374)(https://github.com/FasterXML/jackson-modules-java8/issues/374))
Existing features
DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDSSerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDSallow changing unit-of-time associated with numeric (JSON Number) timestamps b/w milliseconds (false) and nanoseconds (true), in cases where Time value has granularity beyond milliseconds.
As a consequence, when disabled, precision is truncated to millisecond resolution.
These settings have no effect on textual (JSON String) representations, however.
It would be useful to have explicit features -- for this module, that'd be
JavaTimeFeature(in 2.x -- in 3.x it'd be databind's newDateTimeFeature) -- like:JavaTimeFeature.TRUNCATE_TO_MSECS_ON_READJavaTimeFeature.TRUNCATE_TO_MSECS_ON_WRITEwhich would:
TRUNCATE_TO_MSECS_ON_READenabled: after reading Time value, clear nanoseconds part before returning to caller (affects Numeric timestamps too)TRUNCATE_TO_MSECS_ON_WRITEenabled: before writing Time value, clear nanoseconds partThese would alongside but independent
@JsonFormat(pattern = )configuration.Due to plans for 2.x vs 3.x, this should only be considered for 3.x (3.1).