@opengeoweb/taf 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
@@ -7,11 +7,10 @@ import { ReactSortable } from 'react-sortablejs';
7
7
  import Sortable from 'sortablejs';
8
8
  import { useAuthenticationContext } from '@opengeoweb/authentication';
9
9
  import { HIDDEN_INPUT_HELPER_IS_DRAFT, getDeepProperty, useDraftFormHelpers, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
10
- import { dateUtils, useIsMounted, CustomIconButton, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, ToggleMenu, useConfirmationDialog, usePreventBrowserClose, SwitchButton, ToolHeader, AlertBanner, getErrorMessage as getErrorMessage$1, getWarningMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
10
+ import { dateUtils, useIsMounted, CustomIconButton, CustomTooltip, ToolContainerDraggable, Avatar, getInitials, ToggleMenu, useConfirmationDialog, usePreventBrowserClose, SwitchButton, ToolHeader, AlertBanner, getErrorMessage as getErrorMessage$1, getWarningMessage, LastUpdateTime, usePoller, ErrorBoundary } from '@opengeoweb/shared';
11
11
  import { snackbarActions } from '@opengeoweb/snackbar';
12
- import moment from 'moment';
13
12
  import { isEqual } from 'lodash';
14
- import { DragHandle as DragHandle$1, ThumbsUp, Add, Delete, Close, Clock, Cancel, Success, Edit, Export, ListItem, Cached } from '@opengeoweb/theme';
13
+ import { DragHandle as DragHandle$1, ThumbsUp, Add, Delete, Close, Clock, Cancel, Success, Edit, Export, ListItem } from '@opengeoweb/theme';
15
14
  import ReactDOM from 'react-dom';
16
15
  import { useTheme } from '@emotion/react';
17
16
  import { useApiContext, createApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
@@ -649,14 +648,18 @@ var getFieldValue = function getFieldValue(fieldValue) {
649
648
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
650
649
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
651
650
  * */
652
- var FORMAT_DAYS_HOURS = 'DDHH';
653
- var FORMAT_DAYS_HOURS_MINUTES = 'DDHHmm';
651
+ var FORMAT_DAYS_HOURS = 'ddHH';
652
+ var FORMAT_DAYS_HOURS_MINUTES = 'ddHHmm';
653
+ var lengthFM = 6;
654
+ var lengthBECMGTEMPO = 9;
654
655
  // formatters
655
656
  var formatValidToString = function formatValidToString(valid) {
656
657
  // Ensure end of valid period if midnight is shown as 24 and not 00
657
- var endHours = moment.utc(valid.end).format('kk');
658
- var endDate = endHours === '24' ? moment.utc(valid.end).add(-1, 'day').format('DD') : moment.utc(valid.end).format('DD');
659
- return valid.end ? "".concat(moment.utc(valid.start).format(FORMAT_DAYS_HOURS), "/").concat(endDate).concat(endHours) : moment.utc(valid.start).format(FORMAT_DAYS_HOURS_MINUTES);
658
+ var endHours = dateUtils.dateToString(dateUtils.utc(valid.end), 'kk');
659
+ var endDate = endHours === '24' ? dateUtils.dateToString(dateUtils.sub(dateUtils.utc(valid.end), {
660
+ days: 1
661
+ }), 'dd') : dateUtils.dateToString(dateUtils.utc(valid.end), 'dd');
662
+ return valid.end ? "".concat(dateUtils.dateToString(dateUtils.utc(valid.start), FORMAT_DAYS_HOURS), "/").concat(endDate).concat(endHours) : dateUtils.dateToString(dateUtils.utc(valid.start), FORMAT_DAYS_HOURS_MINUTES);
660
663
  };
661
664
  var getSections = function getSections(value, format) {
662
665
  return {
@@ -666,19 +669,31 @@ var getSections = function getSections(value, format) {
666
669
  };
667
670
  };
668
671
  var getValidityTimeStamp = function getValidityTimeStamp(sectionType, sections, startTaf, endTaf) {
669
- var resultMoment = startTaf.clone();
670
- resultMoment.date(sections.day).hours(sections.hour).minutes(sections.min).seconds(0).milliseconds(0);
672
+ var clonedStartTafDate = dateUtils.set(startTaf, {
673
+ date: sections.day,
674
+ hours: sections.hour,
675
+ minutes: sections.min,
676
+ seconds: 0,
677
+ milliseconds: 0
678
+ });
671
679
  // if start and hour is the same but minutes != 00 for the startTaf - set the minutes to account for AMENDED tafs which do not start on the hour
672
- if (sectionType === 'start' && startTaf.date() === resultMoment.date() && startTaf.hours() === resultMoment.hours() && startTaf.minutes() !== resultMoment.minutes()) {
673
- resultMoment.minutes(startTaf.minutes()).seconds(startTaf.seconds());
674
- }
675
- // Only proceed if moment has not bubbled dates overflow to months and not bubbled hours overflow to days
676
- if (resultMoment.date() === sections.day && resultMoment.hours() === sections.hour && resultMoment.minutes() === sections.min || resultMoment.date() === sections.day + 1 && sections.hour === 24 && sections.min === 0) {
677
- if (endTaf.month() !== startTaf.month() && sections.day < 15) {
678
- resultMoment.add(1, 'months');
680
+ var shouldUpdateMinutesSeconds = sectionType === 'start' && startTaf.getDate() === clonedStartTafDate.getDate() && startTaf.getUTCHours() === clonedStartTafDate.getUTCHours() && startTaf.getMinutes() !== clonedStartTafDate.getMinutes();
681
+ var updatedStartTafDate = shouldUpdateMinutesSeconds ? dateUtils.set(clonedStartTafDate, {
682
+ minutes: startTaf.getMinutes(),
683
+ seconds: startTaf.getSeconds()
684
+ }) : clonedStartTafDate;
685
+ // Only proceed if has not bubbled dates overflow to months and not bubbled hours overflow to days
686
+ var isSameTime = updatedStartTafDate.getDate() === sections.day && updatedStartTafDate.getUTCHours() === sections.hour && updatedStartTafDate.getMinutes() === sections.min;
687
+ var isOverflowing = updatedStartTafDate.getDate() === sections.day + 1 && sections.hour === 24 && sections.min === 0;
688
+ if (isSameTime || isOverflowing) {
689
+ var isHalfInMonth = endTaf.getMonth() !== startTaf.getMonth() && sections.day < 15;
690
+ if (isHalfInMonth) {
691
+ return dateUtils.add(updatedStartTafDate, {
692
+ months: 1
693
+ });
679
694
  }
680
695
  }
681
- return resultMoment;
696
+ return updatedStartTafDate;
682
697
  };
683
698
  // parsers
684
699
  var parseValidToObject = function parseValidToObject(value, tafStart, tafEnd) {
@@ -687,23 +702,25 @@ var parseValidToObject = function parseValidToObject(value, tafStart, tafEnd) {
687
702
  }
688
703
  // Create valid object from passed string
689
704
  var trimmedValue = value.trim();
690
- var tafStartMoment = moment.utc(tafStart);
691
- var tafEndMoment = moment.utc(tafEnd);
705
+ var tafStartDate = dateUtils.utc(tafStart);
706
+ var tafEndDate = dateUtils.utc(tafEnd);
692
707
  var startEnd = trimmedValue.split('/');
693
708
  var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
694
709
  var startSections = getSections(startEnd[0], format);
695
- var start = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment).format('YYYY-MM-DDTHH:mm:ss[Z]');
710
+ var startDate = getValidityTimeStamp('start', startSections, tafStartDate, tafEndDate);
711
+ var startString = dateUtils.dateToString(startDate);
696
712
  // If we only have start value - return that otherwise, also get end time
697
713
  if (startEnd.length < 2) {
698
714
  return {
699
- start: start
715
+ start: startString
700
716
  };
701
717
  }
702
718
  var endSections = getSections(startEnd[1], FORMAT_DAYS_HOURS);
703
- var end = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment).format('YYYY-MM-DDTHH:mm:ss[Z]');
719
+ var endDate = getValidityTimeStamp('end', endSections, tafStartDate, tafEndDate);
720
+ var endString = dateUtils.dateToString(endDate);
704
721
  return {
705
- start: start,
706
- end: end
722
+ start: startString,
723
+ end: endString
707
724
  };
708
725
  };
709
726
  // messages
@@ -732,8 +749,8 @@ var validateValidSections = function validateValidSections(sections, isStartEnd)
732
749
  };
733
750
  // Validate to ensure valid dates are passed
734
751
  var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd) {
735
- var tafStartMoment = moment.utc(tafStart);
736
- var tafEndMoment = moment.utc(tafEnd);
752
+ var tafStartDate = dateUtils.utc(tafStart);
753
+ var tafEndDate = dateUtils.utc(tafEnd);
737
754
  var startEnd = value.split('/');
738
755
  var format = value.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
739
756
  var validateMsg = [];
@@ -745,9 +762,9 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
745
762
  if (sectionValidationStart.length) {
746
763
  return sectionValidationStart;
747
764
  }
748
- var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
765
+ var startTimestamp = getValidityTimeStamp('start', startSections, tafStartDate, tafEndDate);
749
766
  // Validate start is within the taf validity bounds
750
- if (startTimestamp < tafStartMoment || startTimestamp > tafEndMoment) {
767
+ if (startTimestamp < tafStartDate || startTimestamp > tafEndDate) {
751
768
  validateMsg.push(invalidValidityStartTimeMessage);
752
769
  }
753
770
  // Validate end time
@@ -759,13 +776,13 @@ var validateIsValidDates = function validateIsValidDates(value, tafStart, tafEnd
759
776
  if (sectionValidationEnd.length) {
760
777
  return sectionValidationEnd;
761
778
  }
762
- var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment);
779
+ var endTimestamp = getValidityTimeStamp('end', endSections, tafStartDate, tafEndDate);
763
780
  // Validate end is not before start
764
781
  if (endTimestamp < startTimestamp) {
765
782
  validateMsg.push(invalidValidityPeriodMessage);
766
783
  }
767
784
  // Validate end is within the taf validity bounds
768
- if (endTimestamp < tafStartMoment || endTimestamp > tafEndMoment) {
785
+ if (endTimestamp < tafStartDate || endTimestamp > tafEndDate) {
769
786
  validateMsg.push(invalidValidityEndTimeMessage);
770
787
  }
771
788
  }
@@ -778,7 +795,7 @@ var validateValidField = function validateValidField(value, tafStart, tafEnd) {
778
795
  return true;
779
796
  }
780
797
  // Validate length and ensure it doesn't contain any other characters than numbers and / and has either XXXX/XXXX or XXXXXX format
781
- if (trimmedValue.length < 6 || trimmedValue.length > 9 || !(trimmedValue.match(/^[0-9]{4}\/[0-9]{4}$/) || trimmedValue.match(/^[0-9]{6}$/))) {
798
+ if (trimmedValue.length < lengthFM || trimmedValue.length > lengthBECMGTEMPO || !(trimmedValue.match(/^[0-9]{4}\/[0-9]{4}$/) || trimmedValue.match(/^[0-9]{6}$/))) {
782
799
  return invalidChangeValidInterFieldMessage;
783
800
  }
784
801
  // Ensure valid date(s) can be made
@@ -809,28 +826,28 @@ var validateValidChangeGroupInterField = function validateValidChangeGroupInterF
809
826
  }
810
827
  if (
811
828
  // Ensure format for FM changegroups is correct DDHHmm
812
- trimmedValue.length > 6 && trimmedValueChange === 'FM' ||
829
+ trimmedValue.length > lengthFM && trimmedValueChange === 'FM' ||
813
830
  // Ensure format for BECMG and TEMPO changegroups is correct DDHH/DDHH
814
- trimmedValue.length < 9 && trimmedValueChange !== 'FM') {
831
+ trimmedValue.length < lengthBECMGTEMPO && trimmedValueChange !== 'FM') {
815
832
  return invalidChangeValidInterFieldMessage;
816
833
  }
817
834
  // Ensure BECMG changegroup has duration of 1,2,3,4 hours
818
835
  if (trimmedValueChange === 'BECMG') {
819
- var tafStartMoment = moment.utc(tafStart);
820
- var tafEndMoment = moment.utc(tafEnd);
836
+ var tafStartDate = dateUtils.utc(tafStart);
837
+ var tafEndDate = dateUtils.utc(tafEnd);
821
838
  var startEnd = trimmedValue.split('/');
822
839
  var format = trimmedValue.indexOf('/') === -1 ? FORMAT_DAYS_HOURS_MINUTES : FORMAT_DAYS_HOURS;
823
840
  // Validate start time
824
841
  var startSections = getSections(startEnd[0], format);
825
- var startTimestamp = getValidityTimeStamp('start', startSections, tafStartMoment, tafEndMoment);
842
+ var startTimestamp = getValidityTimeStamp('start', startSections, tafStartDate, tafEndDate);
826
843
  var endSections = getSections(startEnd[1], FORMAT_DAYS_HOURS);
827
- var endTimestamp = getValidityTimeStamp('end', endSections, tafStartMoment, tafEndMoment);
828
- var timeDifference = endTimestamp.diff(startTimestamp, 'hours', true);
844
+ var endTimestamp = getValidityTimeStamp('end', endSections, tafStartDate, tafEndDate);
845
+ var timeDifference = dateUtils.differenceInHours(endTimestamp, startTimestamp, 'ceil');
829
846
  if (
830
847
  // For non-amendments we only accept 1 to 4 hours
831
848
  timeDifference >= 1 && ![1, 2, 3, 4].includes(Math.ceil(timeDifference)) ||
832
849
  // For amendments the time difference can be below one hour, accept this unless the minute difference is zero
833
- timeDifference < 1 && endTimestamp.diff(startTimestamp, 'minutes') === 0) {
850
+ timeDifference < 1 && dateUtils.differenceInMinutes(endTimestamp, startTimestamp) === 0) {
834
851
  return invalidBECMGDurationValidInterFieldMessage;
835
852
  }
836
853
  }
@@ -856,13 +873,13 @@ var validatePreviousChangeGroup = function validatePreviousChangeGroup(currentCh
856
873
  return true;
857
874
  }
858
875
  // validate is valid time before
859
- var currentStartTime = moment(validValue.start);
860
- var previousRowStartTime = moment(previousValidValue.start);
861
- if (currentStartTime.isBefore(previousRowStartTime)) {
876
+ var currentStartTime = dateUtils.utc(validValue.start);
877
+ var previousRowStartTime = dateUtils.utc(previousValidValue.start);
878
+ if (dateUtils.isBefore(currentStartTime, previousRowStartTime)) {
862
879
  return invalidPreviousChangeGroupIsBeforeMessage;
863
880
  }
864
881
  // validate same valid time
865
- if (currentStartTime.isSame(previousRowStartTime)) {
882
+ if (dateUtils.isEqual(currentStartTime, previousRowStartTime)) {
866
883
  // validate change/probability order
867
884
  var currentProbChangeValue = "".concat(probability, " ").concat(change).trim();
868
885
  var previousProbChangeValue = "".concat(previousProbability, " ").concat(previousChange).trim();
@@ -882,15 +899,18 @@ var validateOverlapWithFM = function validateOverlapWithFM(currentChangeGroup, n
882
899
  if (!valid || !nextChangeGroups.length) {
883
900
  return true;
884
901
  }
902
+ if (valid.length < lengthFM || valid.length > lengthBECMGTEMPO || !(valid.match(/^[0-9]{4}\/[0-9]{4}$/) || valid.match(/^[0-9]{6}$/))) {
903
+ return false;
904
+ }
885
905
  var validValue = parseValidToObject(valid, tafStart, tafEnd);
886
- var currentRowEndTime = moment(validValue.end);
906
+ var currentRowEndTime = dateUtils.utc(validValue.end);
887
907
  var firstFMChangeGroup = nextChangeGroups.find(function (nextChangeGroup) {
888
908
  return getFieldValue(nextChangeGroup.change) === 'FM';
889
909
  });
890
910
  if (firstFMChangeGroup && firstFMChangeGroup.valid) {
891
911
  var FMValidValue = parseValidToObject(firstFMChangeGroup.valid, tafStart, tafEnd);
892
- var FMStartTime = moment(FMValidValue.start);
893
- if (currentRowEndTime.isAfter(FMStartTime)) {
912
+ var FMStartTime = dateUtils.utc(FMValidValue.start);
913
+ if (dateUtils.isAfter(currentRowEndTime, FMStartTime)) {
894
914
  return invalidChangeGroupOverlapsWithFM;
895
915
  }
896
916
  }
@@ -2293,6 +2313,9 @@ var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCl
2293
2313
  var DATE_FORMAT_YEAR = "yyyy-MM-dd'";
2294
2314
  var DATE_FORMAT_ISSUE_TIME = "ddHHmm'Z";
2295
2315
  var DATE_FORMAT_FULL = "yyyy-MM-dd'T'HH:mm:ss'";
2316
+ var DATE_FORMAT_HOURS = 'HH:mm';
2317
+ var DATE_FORMAT_FULL_TIMEZONE = "yyyy-MM-dd'T'HH:mm:ss'Z";
2318
+ var DATE_FORMAT_BASE_TIME = 'HH:mm dd MMM';
2296
2319
 
2297
2320
  var emptyBaseForecast = {
2298
2321
  wind: '',
@@ -2780,16 +2803,18 @@ var getAmendedCorrectedTafTimes = function getAmendedCorrectedTafTimes(taf, tafA
2780
2803
  var previousValidDateEnd = taf.previousValidDateEnd && tafAction !== 'AMEND' ? taf.previousValidDateEnd : taf.validDateEnd;
2781
2804
  // For amendment change valid start time to current time
2782
2805
  // only do this if we're already within the validity period
2783
- if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && moment.utc() >= moment.utc(taf.validDateStart)) {
2784
- var now = moment.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
2806
+ var now = dateUtils.utc();
2807
+ var validDateStart = dateUtils.utc(taf.validDateStart);
2808
+ if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && now.getTime() >= validDateStart.getTime()) {
2809
+ var _now = dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_FULL_TIMEZONE);
2785
2810
  var validObj = {
2786
- start: now,
2811
+ start: _now,
2787
2812
  end: taf.baseForecast.valid.end
2788
2813
  };
2789
2814
  return Object.assign(Object.assign({}, taf), {
2790
2815
  previousValidDateStart: previousValidDateStart,
2791
2816
  previousValidDateEnd: previousValidDateEnd,
2792
- validDateStart: now,
2817
+ validDateStart: _now,
2793
2818
  baseForecast: Object.assign(Object.assign({}, taf.baseForecast), {
2794
2819
  valid: validObj
2795
2820
  })
@@ -4715,23 +4740,25 @@ var sortTafsOnIssueDate = function sortTafsOnIssueDate() {
4715
4740
  });
4716
4741
  };
4717
4742
  var getBaseTime = function getBaseTime(baseTime, location) {
4718
- var currentBaseTime = moment.utc(baseTime);
4743
+ var currentBaseTime = dateUtils.utc(baseTime);
4719
4744
  var activityPeriod = getLocationSetting(location).activity_period;
4720
- var nextBaseTime = moment.utc(baseTime).add(activityPeriod, 'hours');
4745
+ var nextBaseTime = dateUtils.add(dateUtils.utc(baseTime), {
4746
+ hours: activityPeriod
4747
+ });
4721
4748
  return {
4722
4749
  currentBaseTime: currentBaseTime,
4723
4750
  nextBaseTime: nextBaseTime
4724
4751
  };
4725
4752
  };
4726
4753
  var getTafTimeSlot = function getTafTimeSlot(baseTime, location, status) {
4727
- var now = moment.utc();
4754
+ var now = dateUtils.utc();
4728
4755
  var _getBaseTime = getBaseTime(baseTime, location),
4729
4756
  currentBaseTime = _getBaseTime.currentBaseTime,
4730
4757
  nextBaseTime = _getBaseTime.nextBaseTime;
4731
4758
  if (status === 'EXPIRED') {
4732
4759
  return 'EXPIRED';
4733
4760
  }
4734
- if (currentBaseTime < now && nextBaseTime > now) {
4761
+ if (currentBaseTime.getTime() < now.getTime() && nextBaseTime.getTime() > now.getTime()) {
4735
4762
  return 'ACTIVE';
4736
4763
  }
4737
4764
  return 'UPCOMING';
@@ -5288,7 +5315,7 @@ var TacOverviewMobile = function TacOverviewMobile(_ref) {
5288
5315
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
5289
5316
  * */
5290
5317
  var formatBaseTime = function formatBaseTime(time) {
5291
- return time.format('HH:mm DD MMM');
5318
+ return dateUtils.dateToString(time, DATE_FORMAT_BASE_TIME);
5292
5319
  };
5293
5320
  var TopTabs = function TopTabs(_ref) {
5294
5321
  var timeSlot = _ref.timeSlot,
@@ -5691,59 +5718,6 @@ var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
5691
5718
  }, props));
5692
5719
  };
5693
5720
 
5694
- /* *
5695
- * Licensed under the Apache License, Version 2.0 (the "License");
5696
- * you may not use this file except in compliance with the License.
5697
- * You may obtain a copy of the License at
5698
- *
5699
- * http://www.apache.org/licenses/LICENSE-2.0
5700
- *
5701
- * Unless required by applicable law or agreed to in writing, software
5702
- * distributed under the License is distributed on an "AS IS" BASIS,
5703
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5704
- * See the License for the specific language governing permissions and
5705
- * limitations under the License.
5706
- *
5707
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5708
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
5709
- * */
5710
- var getLastUpdateTitle = function getLastUpdateTitle(time) {
5711
- return "Last updated ".concat(time);
5712
- };
5713
- var LastUpdateTime = function LastUpdateTime(_ref) {
5714
- var _ref$onUpdateTaf = _ref.onUpdateTaf,
5715
- onUpdateTaf = _ref$onUpdateTaf === void 0 ? function () {} : _ref$onUpdateTaf,
5716
- lastUpdateTime = _ref.lastUpdateTime;
5717
- return /*#__PURE__*/React__default.createElement(Box, {
5718
- sx: {
5719
- display: 'flex',
5720
- alignItems: 'center',
5721
- height: '100%',
5722
- justifyContent: 'flex-end'
5723
- }
5724
- }, /*#__PURE__*/React__default.createElement(Typography, {
5725
- sx: {
5726
- color: 'geowebColors.captions.captionStatus.rgba',
5727
- fontSize: '10px',
5728
- lineHeight: '1.6',
5729
- letterSpacing: '0.33px'
5730
- },
5731
- "data-testid": "lastupdated-time"
5732
- }, getLastUpdateTitle(lastUpdateTime)), /*#__PURE__*/React__default.createElement(CustomIconButton, {
5733
- "data-testid": "updateTafBtn",
5734
- onClick: onUpdateTaf,
5735
- sx: {
5736
- marginRight: {
5737
- xs: 2,
5738
- sm: 1
5739
- },
5740
- marginLeft: 1
5741
- },
5742
- tooltipTitle: "Click to refresh",
5743
- variant: "tool"
5744
- }, /*#__PURE__*/React__default.createElement(Cached, null)));
5745
- };
5746
-
5747
5721
  var CONFIRM_DIALOG_OPTIONS = {
5748
5722
  title: 'Whoops',
5749
5723
  description: "It's not possible to autosave this TAF due to the presence of issue(s). Are you sure you want to close this TAF? Any changes made will be lost.",
@@ -5753,7 +5727,7 @@ var getTafMessagePrefix = function getTafMessagePrefix(_ref, newStatus) {
5753
5727
  var location = _ref.location,
5754
5728
  validDateStart = _ref.validDateStart,
5755
5729
  messageType = _ref.messageType;
5756
- var formattedDate = formatBaseTime(moment.utc(validDateStart));
5730
+ var formattedDate = formatBaseTime(dateUtils.utc(validDateStart));
5757
5731
  return "TAF ".concat(location, " ").concat(formattedDate, " ").concat(messageType, " was ").concat(newStatus, " successfully");
5758
5732
  };
5759
5733
  var getSnackbarMessage = function getSnackbarMessage(tafFromFrontEnd) {
@@ -6028,7 +6002,8 @@ var TafLayout = function TafLayout(_ref2) {
6028
6002
  sm: 3
6029
6003
  }, lastUpdateTime && ( /*#__PURE__*/React__default.createElement(LastUpdateTime, {
6030
6004
  lastUpdateTime: lastUpdateTime,
6031
- onUpdateTaf: onUpdateTaf
6005
+ onPressRefresh: onUpdateTaf,
6006
+ dataTestId: "lastupdated-time"
6032
6007
  })))), /*#__PURE__*/React__default.createElement(Grid, {
6033
6008
  container: true,
6034
6009
  flexGrow: 1,
@@ -6128,7 +6103,7 @@ var TafWrapper = function TafWrapper(_a) {
6128
6103
  };
6129
6104
 
6130
6105
  var getCurrentDate = function getCurrentDate() {
6131
- return moment.utc().format('HH:mm');
6106
+ return dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_HOURS);
6132
6107
  };
6133
6108
  var TafModule = function TafModule() {
6134
6109
  var _useApiContext = useApiContext(),
package/package.json CHANGED
@@ -1,12 +1,35 @@
1
1
  {
2
2
  "name": "@opengeoweb/taf",
3
- "version": "9.4.1",
3
+ "version": "9.6.0",
4
4
  "description": "GeoWeb TAF 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
+ "@redux-eggs/redux-toolkit": "^2.2.0",
13
+ "@opengeoweb/shared": "*",
14
+ "react-hook-form": "7.47.0",
15
+ "@mui/material": "5.12.0",
16
+ "@opengeoweb/theme": "*",
17
+ "@redux-eggs/saga-extension": "^2.2.0",
18
+ "@opengeoweb/form-fields": "*",
19
+ "@opengeoweb/authentication": "*",
20
+ "@reduxjs/toolkit": "^1.9.7",
21
+ "react-redux": "^8.1.3",
22
+ "@opengeoweb/snackbar": "*",
23
+ "react-sortablejs": "^6.1.4",
24
+ "sortablejs": "^1.15.1",
25
+ "@emotion/react": "^11.11.1",
26
+ "lodash": "^4.17.21",
27
+ "axios": "1.5.0"
28
+ },
29
+ "peerDependencies": {
30
+ "react": "18",
31
+ "react-dom": "18"
32
+ },
10
33
  "module": "./index.esm.js",
11
34
  "type": "module",
12
35
  "main": "./index.esm.js"
@@ -1,6 +1,5 @@
1
1
  import { ChangeGroupFormData, Valid } from '../../../../types';
2
- export declare const FORMAT_DAYS_HOURS = "DDHH";
3
- export declare const FORMAT_DAYS_HOURS_MINUTES = "DDHHmm";
2
+ export declare const FORMAT_DAYS_HOURS_MINUTES = "ddHHmm";
4
3
  export declare const formatValidToString: (valid: Valid) => string;
5
4
  export declare const parseValidToObject: (value: string, tafStart: string, tafEnd: string) => Valid;
6
5
  export declare const invalidValidityDaysHoursStartMessage = "Invalid validity start period, expected a date value between 00 and 31 and an hour value between 00 and 23";
@@ -1,4 +1,3 @@
1
- import { Moment } from 'moment';
2
1
  import React from 'react';
3
2
  import { TafFromBackend, TimeSlot } from '../../../types';
4
3
  interface TopTabsProps {
@@ -6,6 +5,6 @@ interface TopTabsProps {
6
5
  tafFromBackend: TafFromBackend;
7
6
  onChangeTimeSlot?: (timeSlot: TimeSlot, isFormDirty: boolean) => void;
8
7
  }
9
- export declare const formatBaseTime: (time: Moment) => string;
8
+ export declare const formatBaseTime: (time: Date) => string;
10
9
  declare const TopTabs: React.FC<TopTabsProps>;
11
10
  export default TopTabs;
@@ -1,11 +1,10 @@
1
- import { Moment } from 'moment';
2
1
  import { Taf, TafConfigLocation, TafConfigLocations, TafFormData, TafFromBackend, TafStatus, TimeSlot } from '../../types';
3
2
  export declare const getLocationSetting: (location: string, locationSettings?: TafConfigLocations) => TafConfigLocation;
4
3
  export declare const sortTafsOnLocation: (tafList?: TafFromBackend[], locationOrder?: string[]) => TafFromBackend[];
5
4
  export declare const sortTafsOnIssueDate: (tafList?: TafFromBackend[]) => TafFromBackend[];
6
5
  export declare const getBaseTime: (baseTime: string, location: string) => {
7
- currentBaseTime: Moment;
8
- nextBaseTime: Moment;
6
+ currentBaseTime: Date;
7
+ nextBaseTime: Date;
9
8
  };
10
9
  export declare const getTafTimeSlot: (baseTime: string, location: string, status: TafStatus) => TimeSlot;
11
10
  type TafTimeSlots = {
@@ -1,3 +1,6 @@
1
1
  export declare const DATE_FORMAT_YEAR = "yyyy-MM-dd'";
2
2
  export declare const DATE_FORMAT_ISSUE_TIME = "ddHHmm'Z";
3
3
  export declare const DATE_FORMAT_FULL = "yyyy-MM-dd'T'HH:mm:ss'";
4
+ export declare const DATE_FORMAT_HOURS = "HH:mm";
5
+ export declare const DATE_FORMAT_FULL_TIMEZONE = "yyyy-MM-dd'T'HH:mm:ss'Z";
6
+ export declare const DATE_FORMAT_BASE_TIME = "HH:mm dd MMM";
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare const getLastUpdateTitle: (time: string) => string;
3
- interface LastUpdateTimeProps {
4
- onUpdateTaf: () => void;
5
- lastUpdateTime?: string;
6
- }
7
- declare const LastUpdateTime: React.FC<LastUpdateTimeProps>;
8
- export default LastUpdateTime;
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const LastUpdateTimeLightTheme: {
7
- (): React.ReactElement;
8
- storyName: string;
9
- };
10
- export declare const LastUpdateTimeDarkTheme: {
11
- (): React.ReactElement;
12
- storyName: string;
13
- };
@@ -1 +0,0 @@
1
- export { default as LastUpdateTime } from './LastUpdateTime';