@opengeoweb/webmap 4.13.0 → 4.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -2700,7 +2700,7 @@ var getTimeValues = function getTimeValues(isotime) {
2700
2700
 
2701
2701
  /** ************************************************* */
2702
2702
 
2703
- var parseISO8601DateToDate = function parseISO8601DateToDate(_isotime) {
2703
+ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime) {
2704
2704
  /*
2705
2705
  The following functions are added to the standard Date object:
2706
2706
  - add(dateInterval) adds a DateInterval time to this time
@@ -2709,17 +2709,32 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(_isotime) {
2709
2709
  - clone() creates a copy of this object
2710
2710
  */
2711
2711
 
2712
- /** TODO: Maarten Plieger, 2021-09-08
2713
- * https://gitlab.com/opengeoweb/opengeoweb/-/issues/1168
2714
- * This function now only works with strict iso strings in the form YYYY-MM-DDTHH:MM:SSZ.
2715
- * Some WMS's also provide it in different forms like 1981-01 and 2021-12. Make it work with this format too.
2712
+ /** Timeformats according to:
2713
+ * https://portal.ogc.org/files/?artifact_id=14416 / 06-042_OpenGIS_Web_Map_Service_WMS_Implementation_Specification.pdf,
2714
+ * chapter D2.1 are supported
2716
2715
  */
2717
- if (!isValidISOTime(_isotime)) {
2716
+ var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
2717
+ // Datestring starting with a - token are not supported.
2718
+ if (!isoString || isoString.startsWith('-')) return isoString;
2719
+ if (isoString.length === 4) return "".concat(isoString, "-01-01T00:00:00Z"); // YYYY
2720
+
2721
+ if (isoString.length === 7) return "".concat(isoString, "-01T00:00:00Z"); // YYYY-MM
2722
+
2723
+ if (isoString.length === 10) return "".concat(isoString, "T00:00:00Z"); // YYYY-MM-DD
2724
+
2725
+ if (isoString.length === 14) return "".concat(isoString.slice(0, -1), ":00:00Z"); // YYYY-MM-DDTHHZ
2726
+
2727
+ return isoString;
2728
+ };
2729
+
2730
+ var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
2731
+
2732
+ if (!isValidISOTime(isotime)) {
2718
2733
  debug(DebugType.Warning);
2719
2734
  return undefined;
2720
2735
  }
2721
2736
 
2722
- var _getTimeValues = getTimeValues(_isotime),
2737
+ var _getTimeValues = getTimeValues(isotime),
2723
2738
  _getTimeValues2 = _slicedToArray(_getTimeValues, 6),
2724
2739
  year = _getTimeValues2[0],
2725
2740
  month = _getTimeValues2[1],
@@ -5434,11 +5449,12 @@ var WMJSMap = /*#__PURE__*/function () {
5434
5449
  this.setProjection(projinfo.srs, projinfo.bbox);
5435
5450
  }
5436
5451
 
5452
+ if (!this.baseDiv || !this.baseDiv.style) return;
5437
5453
  Object.assign(this.baseDiv.style, {
5438
5454
  width: this.width,
5439
5455
  height: this.height
5440
5456
  });
5441
- if (!this.mainElement.style) return;
5457
+ if (!this.mainElement || !this.mainElement.style) return;
5442
5458
  this.mainElement.style.width = "".concat(this.width, "px");
5443
5459
  this.mainElement.style.height = "".concat(this.height, "px");
5444
5460
  this.setBBOX(this.resizeBBOX);
package/index.umd.js CHANGED
@@ -2699,7 +2699,7 @@
2699
2699
 
2700
2700
  /** ************************************************* */
2701
2701
 
2702
- var parseISO8601DateToDate = function parseISO8601DateToDate(_isotime) {
2702
+ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime) {
2703
2703
  /*
2704
2704
  The following functions are added to the standard Date object:
2705
2705
  - add(dateInterval) adds a DateInterval time to this time
@@ -2708,17 +2708,32 @@
2708
2708
  - clone() creates a copy of this object
2709
2709
  */
2710
2710
 
2711
- /** TODO: Maarten Plieger, 2021-09-08
2712
- * https://gitlab.com/opengeoweb/opengeoweb/-/issues/1168
2713
- * This function now only works with strict iso strings in the form YYYY-MM-DDTHH:MM:SSZ.
2714
- * Some WMS's also provide it in different forms like 1981-01 and 2021-12. Make it work with this format too.
2711
+ /** Timeformats according to:
2712
+ * https://portal.ogc.org/files/?artifact_id=14416 / 06-042_OpenGIS_Web_Map_Service_WMS_Implementation_Specification.pdf,
2713
+ * chapter D2.1 are supported
2715
2714
  */
2716
- if (!isValidISOTime(_isotime)) {
2715
+ var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
2716
+ // Datestring starting with a - token are not supported.
2717
+ if (!isoString || isoString.startsWith('-')) return isoString;
2718
+ if (isoString.length === 4) return isoString + "-01-01T00:00:00Z"; // YYYY
2719
+
2720
+ if (isoString.length === 7) return isoString + "-01T00:00:00Z"; // YYYY-MM
2721
+
2722
+ if (isoString.length === 10) return isoString + "T00:00:00Z"; // YYYY-MM-DD
2723
+
2724
+ if (isoString.length === 14) return isoString.slice(0, -1) + ":00:00Z"; // YYYY-MM-DDTHHZ
2725
+
2726
+ return isoString;
2727
+ };
2728
+
2729
+ var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
2730
+
2731
+ if (!isValidISOTime(isotime)) {
2717
2732
  debug(exports.DebugType.Warning, 'No date given to parseISO8601DateToDate');
2718
2733
  return undefined;
2719
2734
  }
2720
2735
 
2721
- var _a = __read(getTimeValues(_isotime), 6),
2736
+ var _a = __read(getTimeValues(isotime), 6),
2722
2737
  year = _a[0],
2723
2738
  month = _a[1],
2724
2739
  day = _a[2],
@@ -5426,11 +5441,12 @@
5426
5441
  this.setProjection(projinfo.srs, projinfo.bbox);
5427
5442
  }
5428
5443
 
5444
+ if (!this.baseDiv || !this.baseDiv.style) return;
5429
5445
  Object.assign(this.baseDiv.style, {
5430
5446
  width: this.width,
5431
5447
  height: this.height
5432
5448
  });
5433
- if (!this.mainElement.style) return;
5449
+ if (!this.mainElement || !this.mainElement.style) return;
5434
5450
  this.mainElement.style.width = this.width + "px";
5435
5451
  this.mainElement.style.height = this.height + "px";
5436
5452
  this.setBBOX(this.resizeBBOX);
@@ -18,7 +18,7 @@ export declare const parseTimeValue: (value: string) => number;
18
18
  export declare const getTimeValues: (isotime: string) => number[];
19
19
  /** ************************************************* */
20
20
  /** ************************************************* */
21
- export declare const parseISO8601DateToDate: (_isotime: string) => CustomDate;
21
+ export declare const parseISO8601DateToDate: (unvalidatedIsotime: string) => CustomDate;
22
22
  /** ****************************************************** */
23
23
  /** ****************************************************** */
24
24
  export declare const parseISO8601IntervalToDateInterval: (isotime: string) => DateInterval;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "4.13.0",
3
+ "version": "4.14.1",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {