@opengeoweb/sigmet-airmet 9.16.0 → 9.17.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.
Files changed (2) hide show
  1. package/index.esm.js +12 -12
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { FormControlLabel, Radio, Grid, Typography, Box, Button, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItemButton, Backdrop, CircularProgress } from '@mui/material';
4
4
  import { useFormContext } from 'react-hook-form';
5
- import { useDraftFormHelpers, ReactHookFormRadioGroup, DATE_FORMAT_FNS, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, isValidDate, isBefore, isBetween, hasMaxFeaturePoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isAfter, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
5
+ import { useDraftFormHelpers, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, hasMaxFeaturePoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
6
6
  import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
7
7
  import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, addSelectionTypeToGeoJSON, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
8
8
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
@@ -2783,10 +2783,10 @@ const getConfirmationDialogCancelLabel = action => {
2783
2783
  };
2784
2784
  const getProductIssueDate = (initialProduct, initialCancelProduct) => {
2785
2785
  if (initialProduct !== null && (initialProduct.status === 'PUBLISHED' || initialProduct.status === 'EXPIRED') && initialProduct.issueDate) {
2786
- return `${dateUtils.dateToString(dateUtils.utc(initialProduct.issueDate), DATE_FORMAT_FNS)} UTC`;
2786
+ return `${dateUtils.dateToString(dateUtils.utc(initialProduct.issueDate), dateUtils.DATE_FORMAT_DATEPICKER)} UTC`;
2787
2787
  }
2788
2788
  if (initialCancelProduct !== null && initialCancelProduct.issueDate) {
2789
- return `${dateUtils.dateToString(dateUtils.utc(initialCancelProduct.issueDate), DATE_FORMAT_FNS)} UTC`;
2789
+ return `${dateUtils.dateToString(dateUtils.utc(initialCancelProduct.issueDate), dateUtils.DATE_FORMAT_DATEPICKER)} UTC`;
2790
2790
  }
2791
2791
  return '(Not published)';
2792
2792
  };
@@ -3559,9 +3559,9 @@ const ObservationForecastTime = ({
3559
3559
  label: label,
3560
3560
  rules: {
3561
3561
  validate: {
3562
- isValidDate,
3563
- isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? isBefore(val, dateUtils.getCurrentTimeAsString()) || 'Observation time cannot be in the future' : true,
3564
- isBetween: val => watch('isObservationOrForecast') === 'FCST' && val ? isBetween(goZeroSeconds(val), goZeroSeconds(watch('validDateStart')), goZeroSeconds(watch('validDateEnd'))) || ForecastTimeValidation : true
3562
+ isValidDate: dateUtils.isValidIsoDateString,
3563
+ isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? dateUtils.isBefore(val, dateUtils.getNowUtc()) || 'Observation time cannot be in the future' : true,
3564
+ isBetween: val => watch('isObservationOrForecast') === 'FCST' && val ? dateUtils.isBetween(dateUtils.isoStringToDate(val), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateStart'))), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateEnd'))), '[]') || ForecastTimeValidation : true
3565
3565
  }
3566
3566
  },
3567
3567
  disabled: fieldsDisabled,
@@ -4159,7 +4159,7 @@ const ValidFrom = ({
4159
4159
  rules: {
4160
4160
  validate: {
4161
4161
  isRequired,
4162
- isValidDate,
4162
+ isValidDate: dateUtils.isValidIsoDateString,
4163
4163
  // The validity start can not be before the current time
4164
4164
  isValueBeforeCurrentTime: value => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || VALID_FROM_ERROR_BEFORE_CURRENT,
4165
4165
  // The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
@@ -4224,9 +4224,9 @@ const ValidUntil = ({
4224
4224
  rules: {
4225
4225
  validate: {
4226
4226
  isRequired,
4227
- isValidDate,
4227
+ isValidDate: dateUtils.isValidIsoDateString,
4228
4228
  // Validity end has to be after validity start
4229
- isAfter: value => isAfter(value, getValues('validDateStart')) || 'Valid until time has to be after Valid from time',
4229
+ isAfter: value => value ? dateUtils.isAfter(value, getValues('validDateStart')) || 'Valid until time has to be after Valid from time' : true,
4230
4230
  // Validity end can be no more than 4 hours after validity start (6 for VA/TC SIGMET)
4231
4231
  isXHoursAfter: value => isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)) || `Valid until time can be no more than ${getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)} hours after Valid from time`
4232
4232
  }
@@ -9928,7 +9928,7 @@ const formatValidTime = (startDate, endDate, format) => {
9928
9928
  if (!startDate || !endDate) {
9929
9929
  return '-';
9930
9930
  }
9931
- return `${dateUtils.dateToString(dateUtils.utc(startDate), 'dd MMM yyyy, HH:mm')} - ${dateUtils.dateToString(dateUtils.utc(endDate), format)} UTC`;
9931
+ return `${dateUtils.dateToString(dateUtils.utc(startDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} - ${dateUtils.dateToString(dateUtils.utc(endDate), format)} UTC`;
9932
9932
  };
9933
9933
  const ProductListRowHeader = ({
9934
9934
  title
@@ -10033,7 +10033,7 @@ const ProductListRow = ({
10033
10033
  }, [product, apiCall]);
10034
10034
  const cancelsSeqId = isInstanceOfCancelSigmetOrAirmet(product) ? getCancelSeqId(product) : null;
10035
10035
  const phenomenon = isInstanceOfSigmetOrAirmet(product) && product.phenomenon ? product.phenomenon : null;
10036
- const 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';
10036
+ const validTimeFormat = dateUtils.dateToString(dateUtils.utc(product.validDateStart), dateUtils.DATE_FORMAT_YEAR) === dateUtils.dateToString(dateUtils.utc(product.validDateEnd), dateUtils.DATE_FORMAT_YEAR) ? dateUtils.DATE_FORMAT_HOURS : dateUtils.DATE_FORMAT_NAME_OF_MONTH;
10037
10037
  const validTime = formatValidTime(product.validDateStart, product.validDateEnd, validTimeFormat);
10038
10038
  const getLabel = product => {
10039
10039
  const isSigmetOrAirmet = product => {
@@ -10122,7 +10122,7 @@ const ProductListRow = ({
10122
10122
  variant: "subtitle2",
10123
10123
  sx: styles.font,
10124
10124
  "data-testid": "issueTime"
10125
- }, product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), 'dd MMM yyyy, HH:mm')} UTC` : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
10125
+ }, product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} UTC` : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
10126
10126
  className: "col-3",
10127
10127
  item: true
10128
10128
  }, /*#__PURE__*/React__default.createElement(ProductListRowHeader, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.16.0",
3
+ "version": "9.17.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {