geoview-core
    Preparing search index...

    Class DateMgtAbstract

    Class used to handle date as ISO 8601

    DateMgt

    Index

    Constructors

    Methods

    • Reorder the date to the ISO UTC format using the input section (index = 0) of the date fragments order provided. This routine is used to convert the dates returned by the server to the internal ISO UTC format. It is also used to convert the date constants (date '...') found in the layer filter string using a reverse time zone to return the date to the same time zone the server use since the filter string will be sent to the server to perform the query.

      Parameters

      • date: string

        {string} The date to format.

      • dateFragmentsOrder: TypeDateFragments = ISO_UTC_DATE_FRAGMENTS_ORDER

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

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

    • Get the date fragments order. Normaly, the order is year followed by month followed by day.

      Parameters

      • OptionaldateFormat: string

        {string} The date format to be analyzed.

      Returns TypeDateFragments

      array of index indicating the field position in the format. index 0 is for year, 1 for month, 2 for day and 4 for time. A value of -1 indicates theat the fragment is missing.

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