I have this in the frontend, timestamp the most important, as Date
export interface MessageModel {
id?: String;
senderId: String;
receiverId: String;
content: String;
timestamp: Date;
seen: boolean;
}
in the backend, i have this
@Column(name = "timestamp", nullable = false)
private OffsetDateTime timestamp;
and this is the dto
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") // Handles date with timezone
private OffsetDateTime timestamp;
I also added, reading a bunch of solutions here this in application.properties
spring.jackson.serialization.write-dates-as-timestamps=false
but somehow, i still get this error
Unable to make field private final java.time.ZoneOffset java.time.OffsetDateTime.offset accessible: module java.base does not “opens java.time” to unnamed module @61862a7f
i tried a lot of solutions but none of them worked