-
-
Notifications
You must be signed in to change notification settings - Fork 501
Description
Current situation
Currently we have different type of date field handling:
- in database, store date as text
-
in xml, year only, month, date and dateTime are supported and valid.
-
in the index, some dates are stored as defined in the XML (https://github.com/geonetwork/core-geonetwork/blob/develop/schemas/iso19139/src/main/plugin/iso19139/index-fields/default.xsl#L885), some expanded to be date time and adapted to UTC (eg. temporalExtent) See https://github.com/geonetwork/core-geonetwork/blob/develop/domain/src/main/java/org/fao/geonet/domain/ISODate.java#L196
This may introduce issues in:
-
date comparison (in harvesters)
-
date display in record view (may be in UTC instead of original date) eg. setting start of temporal extent to 2012/01/01 (on a server with CEST) will be displayed to 2011/31/12 because adjusted to UTC timezone
Improvements
-
DB settings to set the server timezone Harvester timezone setting #4576
-
Code / Replace Joda lib by Java 8 API to simplify source code (Add timezone support #5061)
Note that from Java SE 8 onwards, users are asked to migrate to java.time (JSR-310) -
a core part of the JDK which replaces this project.
-
DB / Create date in a specific timezone using current date type (eg. UTC) eg. when creating new record, set created date https://github.com/geonetwork/core-geonetwork/blob/develop/core/src/main/java/org/fao/geonet/kernel/DataManager.java#L1486)
-
Index / Index date field for query using a specific timezone and dateTime format (for search and comparison) and store the value to render in a dedicated field (eg. a year should not be displayed as datetime)
-
Index / If a date as no timezone, consider it as using the server setting timezone
-
DB / Migration script
-
UI settings to set the user timezone or (by default) use the browser timezone
- Editor / Add the capability to set date timezone
- Code / Update moment.js lib to latest version and use utcOffset to fix current shift to UTC (issue 2) (https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/utility/UtilityDirective.js#L361)
date = moment(originalDate, 'YYYY-MM-DDtHH-mm-SSSZ').utcOffset('+0100');
- Code / Update harvester code for date comparison
Future work
- DB / Analyse if we can switch to the database date type ?