Skip to content

Date handling Improvement #1970

@fxprunayre

Description

@fxprunayre

Current situation

Currently we have different type of date field handling:

  • in database, store date as text

image

This may introduce issues in:

  1. date comparison (in harvesters)

  2. 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

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

image

  • Editor / Add the capability to set date timezone

image

                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 ?

Reference documents:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions