bug #10079
openFix timezone problems after upgrading jadira.usertype, hibernate and/or mysql drivers
60%
Description
With #9359 and #10067 we upgraded hibernate and joda-time/jadira-usertype versions. Maybe also upgrading mysql-connector or some json library was relevant.
However, the final result was, that the registration date is now not shown correctly anymore on the dataportals.
The reason for this seems to be that in the former version registrationDate was handled like this in the outgoing webservices:
registrationDate "2022-06-21T10:35:25.000Z"
from https://api.phycobank.org/phycobank/registrationDTO.json?identifier=http://phycobank.org/103170
while in the current version it includes timezone
registrationDate "2022-01-26T11:01:10.000+01:00"
So in the new Version the registrationDate brings its timezone (though it is not yet 100% clear if this timezone is taken from the database or from the operating system the CDM Server runs on. This needs further investigation, however, mostoften these 2 will use the same timezones if correctly configured and used in the same institution).
So the dataportal needs to correctly interpretate the new formatting. Currently it seems to leave out the timezone information and therefore leads to incorrect results.
Related issues
Updated by Andreas Müller over 1 year ago
- Related to task #9359: Update cdmlib, taxeditor, cdmserver etc. dependencies added
- Related to task #10067: Update to hibernate 5.4 (or higher) and hibernate search 5.11 and lucene 5.5 added
Updated by Andreas Müller over 1 year ago
- Related to bug #8343: potential timezone problem in application stack added
Updated by Andreas Müller over 1 year ago
This issue is closely related to #8343
Updated by Andreas Müller over 1 year ago
The formatting seems to take place in name.inc, l.844 calling cdm_api.module.format_datetime() l.449 which calls strtotime() which I don't know where it is defined. Is it a build in function?
Updated by Katja Luther over 1 year ago
Andreas Müller wrote in #note-4:
The formatting seems to take place in name.inc, l.844 calling cdm_api.module.format_datetime() l.449 which calls strtotime() which I don't know where it is defined. Is it a build in function?
Yes this is a php function:
Parse about any English textual datetime description into a Unix timestamp
- @link https://php.net/manual/en/function.strtotime.php
- @param string $datetime
- The string to parse. Before PHP 5.0.0, microseconds weren't allowed in
- the time, since PHP 5.0.0 they are allowed but ignored.
- @param int|null $baseTimestamp [optional]
- Default value: now()
- The timestamp which is used as a base for the calculation of relative
- dates.
- @return int|false a timestamp on success, false otherwise. Previous to PHP 5.1.0,
- this function would return -1 on failure.
Updated by Andreas Müller over 1 year ago
- Status changed from New to In Progress
- % Done changed from 0 to 30
AM:
beim derzeitigen Upgrade unserer verwendeten Software Libraries fällt uns gerade wieder ein Thema auf die Füße, welches insbesondere in https://dev.e-taxonomy.eu/redmine/issues/8343 im Zusammenhang mit Phycobank diskutiert wurde.
Das Grundproblem ist, dass wir das Registrierungsdatum mit Uhrzeit erfassen, allerdings zumindest bei der Ausgabe keine Zeitzone mit angeben. Auch bei der Erfassung ist bislang nicht ganz klar, von welcher Zeitzone ausgegangen wird, einerseits bei der Eingabe im Vaadin Editor, andererseits bei den ursprünglich importierten Daten.
Um das derzeitige Problem zu fixen wäre es gut, wenn wir nochmal klar die Anforderungen definieren würden, die Phycobank an die Zeiterfassung hat.
Derzeit sehe ich z.B: auf https://www.phycobank.org/cdm_dataportal/registration?identifier=http%3A//phycobank.org/100160 dass dort eine Uhrzeit ausgegeben wird (derzeit 00:00:00 da dieser Datensatz vermutlich ohne Uhrzeit erfasst wurde) ohne jedoch eine Angabe zur Zeitzone.
Verstehe ich es richtig, dass die Erfassung der Zeit insbesondere erwünscht ist, um ggf. die Prioritätsreihenfolge zweier Namen noch genauer bestimmen zu können als nur über das Datum? Wenn dies der Fall ist, machte eine Angabe ohne Zeitzone nicht viel Sinn, da dann Daten von Neuseeland schlecht mit solchen aus Alaska verglichen werden können.
Habt ihr das in Phycobank mal diskutiert? Bzw. soll die Angabe „Registration on 2018-06-12 00:00:00 in PhycoBank Berlin“ bedeuten, dass es sich um Berlin-Zeit handelt. Das geht m.E. aus dem Text nicht so eindeutig hervor.
Und habt ihr auch diskutiert, wie mit dem im Ticket beschriebenen Daten umgegangen werden soll, die offensichtlich eigentlich keine Uhrzeit, sondern nur ein Datum besitzen, weil z.B. basierend auf importierten historischen Daten?
===
AM:
… ich sehe gerade, dass in Vaadin es gar nicht möglich ist eine Uhrzeit einzugeben bzw. diese nicht angezeigt wird. Da frage ich mich, warum die Uhrzeit im Portal angezeigt wird/werden muss.
===
AM:
Also, wenn wir die Uhrzeit mit Timezone behalten wollen, wofür schon auch einiges spricht, sollten wir ein besseres Format verwenden. Beispiel-Formate findet man auf https://www.php.net/manual/en/function.date.php oder https://www.php.net/manual/en/datetime.format.php
Mein Favorit wäre RFC2822, was dann etwa so aussieht: Wed, 25 Sep 2013 15:28:57 -0700. Natürlich könnten wir uns auch etwas zusammenbauen, was ähnlich aussieht aber ohne „Wed“, was ja unnötig ist.
Lediglich für DateTime die offensichtlich keine Zeit enthalten also deren Zeit letztlich 00:00:00 ist würde ich vorschlagen den gesamten Uhrzeit Teil inklusive Timezone Info zu streichen, sonst bekommen wir häufig 22:00:00 +0200 aber eben mit dem „falschen“ Datum, da die Zeit dann in der lokalen Zeit bereits einen Tag später ist.
Updated by Andreas Müller over 1 year ago
- % Done changed from 30 to 60
For now, I implemented the date formatting in the way that timezone information is added using the "O" format (https://www.php.net/manual/en/datetime.format.php) resulting in something like ... +0200. Also adapted tests accordingly.
Not yet implemented is special "midnight" handling.
Updated by Andreas Müller over 1 year ago
I discussed with WHK how far time information is needed in the phycobank dataportal. According to WHK it is (currently) not needed. So we only need to implement this in a way that always the correct date is shown.
Best solution is to compute the date by by computing the local time from time information and timezone information. If this results in a date change this needs to be added to the date. Finally this updated date is reported.
Updated by Andreas Müller over 1 year ago
- Target version changed from Release 5.32 to Release 5.43
Remaining issues should be solved in next milestone
Updated by Andreas Müller 11 months ago
- Related to task #10055: Updates, upgrades and cleanup 2023 added