Java8 Date/Time formats
See original GitHub issueHi, Maybe I’m missing something so apologies if this is not an issue. I’ve configured my spring boot application to use jackson-datatype-jsr310 by including in pom.xml, all outgoing json is serialized correctly. however I am using a hashmap to set the payload of the the jwt token:
hashMap.put(Claims.ISSUED_AT,LocalDateTime.now);
and this is being serialized in the Long LocalDateTimeFormat:
{"hour":9,"minute":53,"second":49,"nano":288000000,"dayOfYear":193,"dayOfWeek":"WEDNESDAY","month":"JULY","dayOfMonth":12,"year":2017,"monthValue":7,"chronology":{"calendarType":"iso8601","id":"ISO"}
I had a similar issue in another spring boot application where I was using new ObjectMapper() and not using springBoots configured ObjectMapper. Any ideas how I could make jjwt pick up springboots ObjectMapper which would be configured correctly ? I’m using using jjwt version 0.7.0.
Thanks in advance for your help, Peter
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Introduction to the Java 8 Date/Time API - Baeldung
The LocalDate represents a date in ISO format (yyyy-MM-dd) without time. We can use it to store dates like birthdays and paydays. An...
Read more >DateTimeFormatter (Java Platform SE 8 ) - Oracle Help Center
Formatter for printing and parsing date-time objects. This class provides the main application entry point for printing and parsing and provides common ...
Read more >How to Format Date to String in Java 8 [Example Tutorial]
How to change the format of Date in Java String using JDK 8 ; "yyyy-MM-dd HH:mm:ss"); DateTimeFormatter newPattern = ; "yyyy-MM-dd"); LocalDateTime datetime...
Read more >How to Format Date and Time in the Java 8 Date/Time API
Open your text editor and create the Java program that will demonstrate formatting date and time. · Save your file as FormattingDateAndTime. ·...
Read more >Java DateTimeFormatter with Examples - HowToDoInJava
Learn to use DateTimeFormatter for formatting ZonedDateTime , LocalDateTime , LocalDate and LocalTime to string with predefined and custom ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would not support
LocalDateTime
.LocalDateTime
is not an instant and therefore does not identify a point in time. You would need a time zone for that. Which means you don’t know how much time has passed since a claim was issued which means that you don’t know whether it is expired.Even the JSR-310 expert group leader thinks
LocalDateTime
is not generally useful. https://github.com/tc39/proposal-temporal/issues/7#issuecomment-288997620@RockyMM sure,
Instant
,OffsetDateTime
andZonedDateTime
are a great addition and completely fine.