I'm using LocalDateTime
to represent time.
In the debugging mode, I noticed that the time format is not in ISO 8601, which makes me hard to send directly to other apis.
Request class:
public class AgreementRequest {
@NonNull
private String name;
@NonNull
private String description;
@JsonProperty("start_date")
@DateTimeFormat(iso = DATE_TIME)
@NonNull
private String startDate;
}
Initialization:
request = AgreementRequest.builder()
.name("Premium subscription")
.description("Montly subscription")
.startDate(LocalDateTime.now().plusDays(1).toString()).build();
The LocalDateTime.toString
is not either in ISO 8601, the letter z
in ISO8601 is gone.
I have objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
disabled, is this the problem?