-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
Add timezone support #5061
Add timezone support #5061
Conversation
Please pick up the |
a3fbf91
to
5d843b3
Compare
c540c41
to
b31ac31
Compare
Force entity to be saved. ``` [ERROR] Failures: [ERROR] GeonetRepositoryTest.testBatchUpdateAttributes:125 expected:<[Updated DataElem]> but was:<[<md>metadata12</md>]> [ERROR] MetadataRepositoryTest.testIncrementPopularity:95 expected:<33> but was:<32> ``` We don't really know why this is required and how it is linked to the Joda removal.
Use: * `Browser` to use browser timezone * otherwise define a specific timezone to use to display date eg. `Australia/Hobart` Add: * Timezone directive / now support search by offset * Timezone directive / display more values
Test working locally but not on travis: ``` [ERROR] UrlAnalyzerTest.urlCheckerToSetStatus:250 expected:<12> but was:<6> ```
…dex field name for popularity.
Add code removed from MetadataUtils to XslUtils See commit a5a6cd7
There is no great approach for dates without time, except perhaps storing them as a string, and then unpacking them as a date in the current timezone when asked. Any attempt to limit them to a specific timezone is going to end up with glitches like metadata101/iso19139.ca.HNAP#135 |
Interpret the dates/ date-times appearing in the XML document as the timezone set in the settings if the string hasn't a explicit time offset.
This commit adds a migration of the DateTime zones from the zone defined in system timezone setting to UTC in case the date in the database doesn't have a explicit timezone.
I've added a database migration to transform dates that don't have timezone defined into UTC dates using the system timezone setting. |
@juanluisrp I did a quick test of the changes and I noticed that the dates are not showing up for the status history. |
Fixed @ianwallen |
Any plans to backport this to the master/3.12? @juanluisrp |
I will check it @ianwallen. |
Before that, GeoNetwork was storing dates in the database in server timezone. Depending on the configuration dates could be displayed in a timezone which is different from the user timezone.
To improve that situation, this improvements adds:
The default timezone of a fresh GeoNetwork installation will be UTC.
The user interface can define which timezone to use to render dates. For the simple case, it is recommended to set the server timezone and the user interface timezone to the same value it there is no need of multiple timezone support.
browser
can be used to render dates in current user timezoneRemove Joda time library and use standard Java 8 java.time classes.
Migration / After setting the server timezone parameter, use
v402.DateTimeMigrationTask
migration task to update all db timezone.This also means that when you create a new record, save and close, you don't have the status "updated one hour ago". If the title was not changed, it also contains the timezone information: