Class FhirDateTimes

java.lang.Object
org.projecthusky.fhir.emed.ch.common.util.FhirDateTimes

public class FhirDateTimes extends Object
Helper utilities related to FHIR DateTime resources, based on DateTimes.
See Also:
  • DateTimeType
  • Method Details

    • completeToLatestInstant

      public static @Nullable Instant completeToLatestInstant(org.hl7.fhir.r4.model.BaseDateTimeType dateTime)
      Takes a FHIR BaseDateTimeType element, sets the resolution to the fraction of seconds by filling missing values to the end of the year, month, day, hour, minute and second if needed (i.e. sets it to the latest instant covered by the partial date).

      For instance, if the value "2019-03" is given, the day is fixed to the end of the month (the last of march) and the time is set to the end of the day (usually 23:59:59), which results in: "2019-03-31T235959".

      If the FHIR date time is already precise to the milliseconds, it will be returned as the equivalent Instant with no further transformation.

      Parameters:
      dateTime - The FHIR date time element.
      Returns:
      the full precision instant.