geoview-core
    Preparing search index...

    Class DateMgtAbstract

    Class used to handle date as ISO 8601

    DateMgt

    Index

    Constructors

    Methods

    • Converts and normalizes a date string into a standard ISO8601 UTC-based format. This function supports a variety of input formats:

      • Partial dates: "YYYY", "YYYY-MM", "YYYY-MM-DD"
      • Dates with or without time: "YYYY-MM-DD", "YYYY-MM-DDTHH:mm", etc.
      • UTC "Z" suffix: "1988-09-13Z"
      • Flexible separators: "/" → "-", space → "T" It applies defaults for missing components:
      • Missing month/day defaults to "01"
      • Missing time defaults to "00:00:00"
      • Missing timezone defaults to the configured separator and offset (typically "+00:00") Optional features:
      • reverseTimeZone: flips the sign of the timezone offset if provided

      Parameters

      • date: string

        The input date string to normalize.

      • OptionaldateFragmentsOrder: TypeDateFragments = ISO_UTC_DATE_FRAGMENTS_ORDER

        Configuration array defining the index order of year, month, day, and separator characters.

      • OptionalreverseTimeZone: boolean = false

        If true, reverses the sign of the timezone offset.

      Returns string

      The normalized ISO8601 date string, e.g., "1988-09-13T00:00:00Z".

      Throws an error if the input cannot be parsed or normalized into a valid ISO date.

      applyInputDateFormat("1988-09-13Z");
      // returns "1988-09-13T00:00:00Z"
      applyInputDateFormat("1988-9-3 14:5");
      // returns "1988-09-03T14:05:00+00:00" (assuming default separators)
      applyInputDateFormat("1988-09", ISO_UTC_DATE_FRAGMENTS_ORDER, true);
      // returns "1988-09-01T00:00:00+00:00" (timezone reversed if needed)
    • Reorder the ISO UTC date to the output format using the output section (index = 1) of the date fragments order provided. The time zone is empty since all dates shown to the user are in UTC.

      Parameters

      • date: string

        {string} The ISO date to format.

      • OptionaldateFragmentsOrder: TypeDateFragments

        {TypeDateFragments} The date fragments order (obtained with getDateFragmentsOrder).

      • reverseTimeZone: boolean = false

        {boolean} Flag indicating that we must change the time zone sign before the conversion.

      Returns string

      The reformatted date string.

    • Convert a milliseconds date to string date. Date format is YYYY-MM-DDTHH:mm:ss.

      Parameters

      • date: number

        milliseconds date

      • dateFormat: string = 'YYYY-MM-DDTHH:mm:ss'

      Returns string

      date string

    • Convert a date local to a UTC date

      Parameters

      • date: string | Date

        date to use

      Returns string

      UTC date or empty string if invalid date (when field value is null)

    • Create locale tooltip (fr-CA or en-CA)

      Parameters

      • date: string

        {string} date to use

      • locale: TypeDisplayLanguage

        {string} locale to use (fr-CA or en-CA)

      Returns string

      locale tooltip

    • Create the Geoview time dimension from OGC dimension

      Parameters

      • ogcTimeDimension: string | TypeMetadataWMSCapabilityLayerDimension

        The OGC time dimension object or string

      Returns TimeDimension

      the Geoview time dimension

    • Create a range of date object from OGC time dimension following ISO 8601

      Parameters

      • ogcTimeDimensionValues: string

      Returns RangeItems

      array of date from the dimension

    • Format a date to specific format like 'YYYY-MM-DD'

      Parameters

      • date: string | Date

        date to use

      • format: string

        format of the date.

      Returns string

      formatted date

    • Converts a Date object to an ISO 8601 formatted string in the local time zone. The resulting string will be in the format: YYYY-MM-DDTHH:mm:ss.sss

      Parameters

      • date: string | number | Date

        The Date object to be formatted.

      Returns string

      The formatted date string in ISO 8601 format.

      If the input is not a valid Date object.

    • Returns the input/output fragment order and separators for a given date format. Supports formats like "YYYY-MM-DD", "YYYY-MM-DDTHH:MM:SS", or "YYYY-MM-DDZ".

      Parameters

      • OptionaldateFormat: string

        Optional date format string to analyze.

      Returns TypeDateFragments

      The input/output fragment positions and separators.

      When the provided date format is invalid.

    • Attempts to guess the display pattern for a given date based on the provided format string.

      Parameters

      • dates: string[] | number[] | Date[]

        An array of dates to analyze. Can be Date objects, timestamps (numbers), or date strings.

      • OptionalonlyMinMax: boolean = true

        If true, only considers the minimum and maximum dates in the array.

      Returns [DatePrecision, TimePrecision]

      A tuple containing the guessed date and time precision.