@opengeoweb/sigmet-airmet 9.4.1 → 9.6.0

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
@@ -8,7 +8,6 @@ import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defa
8
8
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
9
9
  import { DrawFIRLand, ChevronLeft, Edit, Success, Clock } from '@opengeoweb/theme';
10
10
  import { LayerType, webmapUtils } from '@opengeoweb/webmap';
11
- import moment from 'moment';
12
11
  import { debounce } from 'lodash';
13
12
  import { useDispatch, useSelector, shallowEqual } from 'react-redux';
14
13
  import { mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncConstants } from '@opengeoweb/store';
@@ -2054,6 +2053,12 @@ var ObservationForecast = function ObservationForecast(_ref) {
2054
2053
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
2055
2054
  * */
2056
2055
  var ForecastTimeValidation = 'Forecast time should lie between the valid start and valid end time';
2056
+ var goZeroSeconds = function goZeroSeconds(val) {
2057
+ return dateUtils.dateToString(dateUtils.set(dateUtils.utc(val), {
2058
+ seconds: 0,
2059
+ milliseconds: 0
2060
+ }));
2061
+ };
2057
2062
  var ObservationForecastTime = function ObservationForecastTime(_ref) {
2058
2063
  var isDisabled = _ref.isDisabled,
2059
2064
  isReadOnly = _ref.isReadOnly,
@@ -2063,9 +2068,6 @@ var ObservationForecastTime = function ObservationForecastTime(_ref) {
2063
2068
  var _useFormContext = useFormContext(),
2064
2069
  watch = _useFormContext.watch;
2065
2070
  var label = getFieldLabel('Date and time', isReadOnly);
2066
- var goZeroSeconds = function goZeroSeconds(val) {
2067
- return moment.utc(val).seconds(0).milliseconds(0).toISOString();
2068
- };
2069
2071
  var _useShortTestHelpers = useShortTestHelpers(),
2070
2072
  isShortTest = _useShortTestHelpers.isShortTest;
2071
2073
  var fieldsDisabled = isDisabled || isShortTest();
@@ -2080,7 +2082,7 @@ var ObservationForecastTime = function ObservationForecastTime(_ref) {
2080
2082
  validate: {
2081
2083
  isValidDate: isValidDate,
2082
2084
  isBefore: function isBefore$1(val) {
2083
- return watch('isObservationOrForecast') === 'OBS' && val ? isBefore(val, moment.utc().format()) || 'Observation time cannot be in the future' : true;
2085
+ return watch('isObservationOrForecast') === 'OBS' && val ? isBefore(val, dateUtils.dateToString(dateUtils.utc())) || 'Observation time cannot be in the future' : true;
2084
2086
  },
2085
2087
  isBetween: function isBetween$1(val) {
2086
2088
  return watch('isObservationOrForecast') === 'FCST' && val ? isBetween(goZeroSeconds(val), goZeroSeconds(watch('validDateStart')), goZeroSeconds(watch('validDateEnd'))) || ForecastTimeValidation : true;
@@ -7751,10 +7753,10 @@ var styles = {
7751
7753
  };
7752
7754
  var getActiveStatus = function getActiveStatus(product) {
7753
7755
  // do not return an icon if product is expired
7754
- if (moment(product.validDateEnd) < moment.utc(new Date())) {
7756
+ if (dateUtils.utc(product.validDateEnd) < dateUtils.utc()) {
7755
7757
  return null;
7756
7758
  }
7757
- var active = moment(product.validDateStart) <= moment.utc(new Date());
7759
+ var active = dateUtils.utc(product.validDateStart) <= dateUtils.utc();
7758
7760
  return active ? ( /*#__PURE__*/React__default.createElement(Success, {
7759
7761
  "data-testid": "status-active",
7760
7762
  sx: styles.activeStatus
@@ -7782,7 +7784,7 @@ var getStatusTagList = function getStatusTagList(product, cancelsSeqId) {
7782
7784
  }
7783
7785
  });
7784
7786
  }
7785
- if (moment(product.validDateEnd) < moment.utc(new Date())) {
7787
+ if (dateUtils.utc(product.validDateEnd) < dateUtils.utc()) {
7786
7788
  return /*#__PURE__*/React__default.createElement(StatusTag, {
7787
7789
  content: "expired",
7788
7790
  color: "grey",
@@ -7816,7 +7818,7 @@ var formatValidTime = function formatValidTime(startDate, endDate, format) {
7816
7818
  if (!startDate || !endDate) {
7817
7819
  return '-';
7818
7820
  }
7819
- return "".concat(moment.utc(startDate).format('DD MMM YYYY, HH:mm'), " - ").concat(moment.utc(endDate).format(format), " UTC");
7821
+ return "".concat(dateUtils.dateToString(dateUtils.utc(startDate), 'dd MMM yyyy, HH:mm'), " - ").concat(dateUtils.dateToString(dateUtils.utc(endDate), format), " UTC");
7820
7822
  };
7821
7823
  var ProductListRowHeader = function ProductListRowHeader(_ref) {
7822
7824
  var title = _ref.title;
@@ -7922,7 +7924,7 @@ var ProductListRow = function ProductListRow(_ref2) {
7922
7924
  }, [product, apiCall]);
7923
7925
  var cancelsSeqId = isInstanceOfCancelSigmetOrAirmet(product) ? getCancelSeqId(product) : null;
7924
7926
  var phenomenon = isInstanceOfSigmetOrAirmet(product) && product.phenomenon ? product.phenomenon : null;
7925
- var validTimeFormat = moment.utc(product.validDateStart).format('DD MMM YYYY') === moment.utc(product.validDateEnd).format('DD MMM YYYY') ? 'HH:mm' : 'DD MMM YYYY, HH:mm';
7927
+ var validTimeFormat = dateUtils.dateToString(dateUtils.utc(product.validDateStart), 'dd MMM yyyy') === dateUtils.dateToString(dateUtils.utc(product.validDateEnd), 'dd MMM yyyy') ? 'HH:mm' : 'dd MMM yyyy, HH:mm';
7926
7928
  var validTime = formatValidTime(product.validDateStart, product.validDateEnd, validTimeFormat);
7927
7929
  return /*#__PURE__*/React__default.createElement(Card, {
7928
7930
  elevation: 0,
@@ -7986,7 +7988,7 @@ var ProductListRow = function ProductListRow(_ref2) {
7986
7988
  variant: "subtitle2",
7987
7989
  sx: styles.font,
7988
7990
  "data-testid": "issueTime"
7989
- }, product.issueDate ? "".concat(moment.utc(product.issueDate).format('DD MMM YYYY, HH:mm'), " UTC") : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
7991
+ }, product.issueDate ? "".concat(dateUtils.dateToString(dateUtils.utc(product.issueDate), 'dd MMM yyyy, HH:mm'), " UTC") : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
7990
7992
  className: "col-3",
7991
7993
  item: true
7992
7994
  }, /*#__PURE__*/React__default.createElement(ProductListRowHeader, {
package/package.json CHANGED
@@ -1,12 +1,36 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.4.1",
3
+ "version": "9.6.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
+ "dependencies": {
11
+ "@opengeoweb/api": "*",
12
+ "@opengeoweb/shared": "*",
13
+ "@mui/material": "5.12.0",
14
+ "@opengeoweb/theme": "*",
15
+ "@opengeoweb/store": "*",
16
+ "@opengeoweb/webmap": "*",
17
+ "@opengeoweb/webmap-react": "*",
18
+ "react-redux": "^8.1.3",
19
+ "@opengeoweb/core": "*",
20
+ "@opengeoweb/timeslider": "*",
21
+ "@opengeoweb/authentication": "*",
22
+ "@mui/system": "^5.15.1",
23
+ "@opengeoweb/form-fields": "*",
24
+ "react-hook-form": "7.47.0",
25
+ "axios": "1.5.0",
26
+ "lodash": "^4.17.21",
27
+ "@redux-eggs/redux-toolkit": "^2.2.0",
28
+ "@redux-eggs/saga-extension": "^2.2.0",
29
+ "@reduxjs/toolkit": "^1.9.7"
30
+ },
31
+ "peerDependencies": {
32
+ "react": "18"
33
+ },
10
34
  "module": "./index.esm.js",
11
35
  "type": "module",
12
36
  "main": "./index.esm.js"
@@ -1,5 +1,5 @@
1
1
  import { Sigmet, SigmetFromBackend } from '../../types';
2
- export declare const dateFormatUTC = "YYYY-MM-DDTHH:mmZ";
2
+ export declare const dateFormatUTC = "yyyy-MM-dd'T'HH:mm'Z'";
3
3
  export declare const fakeSigmetList: SigmetFromBackend[];
4
4
  export declare const fakeDataBox: SigmetFromBackend;
5
5
  export declare const fakeDataPoly: SigmetFromBackend;