I guess that’s due to the written date format that can’t be understand: “Wed Jun 03 2020 00:00:00 GMT+0000 (Coordinated Universal Time)”
It looks like it’s most similar with the format: EEE MMM dd yyyy HH:mm:ss ‘GMT’Z ‘(’‘Coordinated Universal Time’’)’ DateTimeFormatter (Java Platform SE 8 ) but it’s not working
Is there still a way to add this using a particular format date?
DateFormat EEE MMM dd yyyy HH:mm:ss 'GMT'Z (zzzz) was not my idea, it is from gemini.
Thinking about daynames and monthnames in my locale and in your string, I try the following DateFormat EEE MMM dd yyyy HH:mm:ss 'GMT'Z (zzzz)[en], but nothing changed.
@ProgFriese I believe line number is 253 is the relevant one. The date format is created using the locale that the program is used to run. In so far Gemini is correct…
I think we would need a new property, locale, which is used to create the data formatting pattern. If it is not set, then we fall back to the current default locale
No. The date pattern is created at the time when the data is downloaded. That locale is used.
I am a bit puzzled by the fact that the user has to specify a date format let alone a locale. JSON dates can be parsed in a locale-agnostic way, afair. This was the case when I authored a date parser over a decade ago at least. The code ended up in Apples Safari so it was working well enough for lots of users.
I do lack the historic knowledge of the needs in PP however. There possibly was a need for the introduction of the Date Format field? Due to the limitations of the Java date parsing code maybe?
Dates come in all shapes and forms apparently. Sometimes as numbers - in milliseconds, or seconds, or days - and sometimes as strings - as ISO dates, with time or without, with timezone or without - with an assumed timezone or as UTC.
Most of those cases, PP attempts to derive a reasonable way to parse the dates. To handle, edge cases, the (optional) configuration was added.
In this particular case, it was in the form of “Wed Jun 03 2020 00:00:00 GMT+0000 (Coordinated Universal Time)”.
Thinking about it, I agree that it can make sense to always use the en_US locale to parse dates (instead of the default locale). Only if the dates are then provided in - say German - locale the user could override. But I admit that is less likely for an API that is less likely.
One more things comes to mind: We should change the UI so that the mandatory fields are marked (URL, JSON path to date and price). All other things are optional.
Thanks for the quick reply. And sorry for the late input. I got the IDE working only two days ago.
The lack of real date format standardization is a big pita indeed. Getting the cited C++ -based parser compatible with real world string representations took ages and required many exceptions and fault tolerance.
The format encountered by the reporter of this issue is trivial in comparison though. It should not require any extra configuration options. Here is what my Web browser makes out of the string:
new Date(“Wed Jun 03 2020 00:00:00 GMT+0000 (Coordinated Universal Time)”)
Date Wed Jun 03 2020 02:00:00 GMT+0200 (Central European Summer Time)
Except of really buggy implementations it should be safe to assume that JSON as emitted by a provider can be parsed by a Web browser or any other JSON client without any extra format and locale specification. Otherwise, a lot of other client software would already be in trouble.
Oh, well. It seems to be too late for the next release. But I will keep an eye on this to see whether the user experience can be simplified. As you suggested, the marking of mandatory fields would be a first step.
Even with the new feature in PP allowing you to specify a Locale you might still have parsing issues, if the abbreviated month is german. The template-character M means the “context sensitive” month (see SimpleDateFormat (Java Platform SE 8 ) while there is another template - L - for the “standalone” month. The examples don’t help because there is no difference between those two with en_US (I’ve already complained about this in i18n-dev but to no avail). When using de_DE as Locale you e.g. get Sep. when using the context sensitive version. This is also expected when parsing a date which might explain why parsing fails even with months that share the same abbreviated form.