Java time default formatters
Originally https://github.com/micronaut-projects/micronaut-core/pull/6576
The Java Time classes have default formatters built in which use the ISO formats. So if in micronaut somewhere a string is to be converted to one of those classes we expect the default format to be the default format of the classes.
Up to now micronaut used RFC_1123_DATE_TIME as the default format for converting but this is a rather human readable format and does not use the defaults that are already there.
Another advantage of the built in defaults is, that they the classes do use the same format in .toString(). So i.e. OffsetDateTime.toString() is compatible with OffsetDateTime.parse() without thinking about the format.
We also need tests for declarative clients that send date headers
Added some tests to a declarative client with a header (once I eventually worked out how to make one) ☺️
@timyates This needs documentation, otherwise good to go imo
Edit: I think you misunderstood the declarative client tests. The tests should be sending headers via arguments to the client methods. For example @Header OffsetDateTime date. None of the declarative client methods take arguments
@jameskleeh Ahhh, so I moved the header into the client:
@Get('/header-localdatetime')
String headerLocalDateTime(@Header('X-Test') LocalDateTime date)
And you're right... It seems to be sending it through in the wrong format 🤔 Good catch, I'm looking in to it
Right, I think that handles the declarative client conversions... Need to make sure it works on a non-GMT machine though... The perils of living on GMT
@jameskleeh Probably worth you running DateTimeConversionSpec locally to check the conversion to GMT works for you
That's awesome 😍
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 3 committers have signed the CLA.
:white_check_mark: timyates
:x: ckosmowski
:x: jameskleeh
You have signed the CLA already but the status is still pending? Let us recheck it.