-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing javadoc for SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
#1624
Comments
@hvgotcodes As you may know, ISO-8601 is a meta-standard and allows specifying and using a wide variety of concrete format variants. It is NOT a single format string. So I am not convinced these are not ISO-8601 compatible without some more documentation -- like link to an article (or Wikipedia entry) that outlines why format is not compatible. But more importantly, I would be interested in improvements to wording; so PRs would be welcome. |
ISO8601 allows the time offset to be represented in the form The standard is quite flexible and allows for many variants - which quickly becomes a nightmare when dealing with clients on different platforms or using different libraries. Safari and Apple iOS are indeed known to only accept an offset expressed with columns (the |
@cowtowncoder @brenuart That's bullshit. ISO 8601 (no hyphen here) is not a meta standard. Is says clear and loud either all components have to be basic or extended, but not mixed. If you don't have access to the actual standard document, don't postulate things. There are no variaties, all input is telescoping. See also https://issues.apache.org/jira/browse/MSHARED-837 Using SDF is just limited. If doing extended, you must use 95% if never really understood the standard because they don't have access to the document. Unfortunately, I cannot share the document because the copy I have is solely licensed to our enterprise. I can cite portions if you like. @hvgotcodes, I am fully with you! |
So yes, if as part of the issue, an excerpt from the standard could be included to back it up, that would be helpful. (I could swear I was reading the full document on 8601, but now when I browse certain parts, such as the appendix, it pops up with a message stating that I need to buy it, at But I do find this:
|
@kupci, strictly speaking, |
@michael-o Fuck you too. |
Now that we have exchanged words of love, can we get this fixed finally? I am willing to provide an SR. |
Ok let's put this to rest. A) An ISO Standard is a global standard and cannot be IP'd by definition. If you have an IP version it is because you are reading an altered/personalized/customized version. These versions will not be entertained as official standards. B) ISO 8601:2004 defines the standard as "YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)"
I strongly suspect your version of the ISO is an "adopted standard", that you are using the 2019-2 customization C) +00:00 is a nullifier. parsing it is pointless, as is it's inclusion.
There is no "Z" in this ISO standard that is followed by a time zone specification. That is the So either - Use java.time to adopt the standard that matches with DateTimeFormatter for your format which does work 100%, or swop your ISO to match that represented by java.util.Date which is simple date format prettified. Now can we please put this to bed, |
@GedMarc How does this relate to the issue here? |
@michael-o You are using java.util.Date instead of java.time. for your date format. In a nutshell - Switch to a LocalDateTime, ZonedDateTime or similar, use @jsonformat, and then of course stop requesting IP standards to be included in open source software which by default is built on global standards and not customized IP ones. In this case, @cowtowncoder comment is 100% valid, the library is matched perfectly to the specification, and you are requesting for IP to be included in an open source library. In a nutshell, and to quote, I will also say - "Fuck you too" |
@GedMarc, I am not. I am using About the IP stuff: no, I disagree. If you claim that your stuff is compliant w/o even having read the standard then don't claim to be compliant. It is not my fault that the standard is freely available. |
K, Have fun. Freely official available one is the open one (use my link in my first comment) and not your customized IP please buy it one.
It is not ISO8601 compliant - it is custom IP buy this crap 2019-2 compliant. the ISO 8601 compliant version is simply "2017-05-10T07:00:00.000Z" or without the Z You need to stop this now. |
I don't understand why you keep wrinting that? As far as I am concerned, I don't have any custom standard here. I have access to the original documents from the standards bodies.
Are you really certain? Chapter 4.3.13 says:
I haven't found any spots which either permits or forbids |
Just verfied, disable |
Many confusing parts so I am not sure what is supposed to be fixed (wrt date/time types: databind itself only supports Further for specific question of including colon or not, my recollection is that JDK formatters themselves are problematic; this may or many not be problematic. But what is problematic is backwards compatibility: behavior for 3.0 ( So:
|
Correct,
It should be corrected in 2.x towards a behavioral change in 3.0. The Java 8 module will be of no use because you probably will require Java 8 and thus, it will be the default. |
By splitting I meant division to different modules: handlers for For now I assume this is about Now: use of But actually
which may be called to change default setting, if configured directly. Looks like it was added for #1744.
which obviously is not good user experience but allowed working around the issue. Long story short, tho: we could change default for this setting to true for 2.11. |
Sent question, proposing change for 2.11. Concern is the usual backwards compatibility: some users somewhere are almost certainly counting on existing default behavior. For what it is worth, 3.0 already includes colon by default. |
@cowtowncoder I agree that it should be changed for 2.11, for 3.0 most of this class ( |
java.util.Date
/Calendar
(ISO-8601 compliancy)
Hmmh. Shoot. Was about to add a transient I think this means that there needs to be at least one pre-release/release candidate for 2.11, to let users kick tires. |
java.util.Date
/Calendar
(ISO-8601 compliancy)SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
So, created #2643 for part about timezone offset not being ISO-8601 compliant (but earlier RFC-1123). Tried to improve javadoc for feature, but it is difficult. |
I know I'm late, just rectifying some wrong information:
Global standards are IP'd, just like everything anybody publishes. 50 years ago, it was customary for standards bodies to charge for their standards, just as a means of financing.
That's not a standard. It's a draft. It explicitly says so on page 1: |
Using Jackson 2.8
The documentation for
WRITE_DATES_AS_TIMESTAMPS
in part readsThe documentation for
WRITE_DATE_KEYS_AS_TIMESTAMPS
in part readsThis implies that if
WRITE_DATES_AS_TIMESTAMPS
is disabled Jackson should return ISO8601 compliant Strings.The problem is that a DateFormat string of "yyyy-MM-dd'T'HH:mm:ss.SSSZ" is NOT ISO8601 compliant.
The values serialized look like
2017-05-10T07:00:00.000+0000
. This is not 8601 compliant.Compare to
2017-05-10T07:00:00.000+00:00
which IS 8601 compliant.If I try take a string Jackson serializes with the above format and create a new Date in Safari, the date is invalid.
I get around this by doing
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"));
The text was updated successfully, but these errors were encountered: