@opengeoweb/taf 9.12.0 → 9.13.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
@@ -3926,6 +3926,7 @@ const invalidValidityPeriodMessage = 'Invalid validity period, validity end time
3926
3926
  const invalidValidityEndTimeMessage = 'Invalid validity end time, change group validity must lie within the TAF validity period';
3927
3927
  const invalidChangeValidInterFieldMessage = 'Invalid validity period, expected DDHH/DDHH for PROB, BECMG and TEMPO or DDHHmm for FM';
3928
3928
  const invalidBECMGDurationValidInterFieldMessage = 'Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed';
3929
+ const invalidTEMPODurationValidInterfieldMessage = 'Invalid validity period, for TEMPO a validity period of at least 1 hour is required';
3929
3930
  const invalidChangeGroupOverlapsWithFM = 'The valid time of a change group cannot overlap with the valid time of a following FM group. This change group should end before or at the hour of the start of the FM group';
3930
3931
  // Validations
3931
3932
  // Ensure all individual sections are correct (DD HH mm etc)
@@ -4025,8 +4026,8 @@ const validateValidChangeGroupInterField = (value, valueChange, valueProb, tafSt
4025
4026
  trimmedValue.length < lengthBECMGTEMPO && trimmedValueChange !== 'FM') {
4026
4027
  return invalidChangeValidInterFieldMessage;
4027
4028
  }
4028
- // Ensure BECMG changegroup has duration of 1,2,3,4 hours
4029
- if (trimmedValueChange === 'BECMG') {
4029
+ // Ensure BECMG changegroup duration for BECMG and TEMPO
4030
+ if (trimmedValueChange === 'BECMG' || trimmedValueChange === 'TEMPO') {
4030
4031
  const tafStartDate = dateUtils.utc(tafStart);
4031
4032
  const tafEndDate = dateUtils.utc(tafEnd);
4032
4033
  const startEnd = trimmedValue.split('/');
@@ -4037,12 +4038,21 @@ const validateValidChangeGroupInterField = (value, valueChange, valueProb, tafSt
4037
4038
  const endSections = getSections(startEnd[1], FORMAT_DAYS_HOURS);
4038
4039
  const endTimestamp = getValidityTimeStamp('end', endSections, tafStartDate, tafEndDate);
4039
4040
  const timeDifference = dateUtils.differenceInHours(endTimestamp, startTimestamp, 'ceil');
4040
- if (
4041
- // For non-amendments we only accept 1 to 4 hours
4042
- timeDifference >= 1 && ![1, 2, 3, 4].includes(Math.ceil(timeDifference)) ||
4043
- // For amendments the time difference can be below one hour, accept this unless the minute difference is zero
4044
- timeDifference < 1 && dateUtils.differenceInMinutes(endTimestamp, startTimestamp) === 0) {
4045
- return invalidBECMGDurationValidInterFieldMessage;
4041
+ // Ensure BECMG changegroup has duration of 1,2,3,4 hours
4042
+ if (trimmedValueChange === 'BECMG') {
4043
+ if (
4044
+ // For non-amendments we only accept 1 to 4 hours
4045
+ timeDifference >= 1 && ![1, 2, 3, 4].includes(Math.ceil(timeDifference)) ||
4046
+ // For amendments the time difference can be below one hour, accept this unless the minute difference is zero
4047
+ timeDifference < 1 && dateUtils.differenceInMinutes(endTimestamp, startTimestamp) === 0) {
4048
+ return invalidBECMGDurationValidInterFieldMessage;
4049
+ }
4050
+ }
4051
+ // Ensure TEMPO changegroup has duration of at least 1 hour
4052
+ if (trimmedValueChange === 'TEMPO') {
4053
+ if (timeDifference < 1) {
4054
+ return invalidTEMPODurationValidInterfieldMessage;
4055
+ }
4046
4056
  }
4047
4057
  }
4048
4058
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/taf",
3
- "version": "9.12.0",
3
+ "version": "9.13.0",
4
4
  "description": "GeoWeb TAF library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,6 +10,7 @@ export declare const invalidValidityPeriodMessage = "Invalid validity period, va
10
10
  export declare const invalidValidityEndTimeMessage = "Invalid validity end time, change group validity must lie within the TAF validity period";
11
11
  export declare const invalidChangeValidInterFieldMessage = "Invalid validity period, expected DDHH/DDHH for PROB, BECMG and TEMPO or DDHHmm for FM";
12
12
  export declare const invalidBECMGDurationValidInterFieldMessage = "Invalid validity period, for BECMG only validity periods with a duration of 1, 2, 3 or 4 hours are allowed";
13
+ export declare const invalidTEMPODurationValidInterfieldMessage = "Invalid validity period, for TEMPO a validity period of at least 1 hour is required";
13
14
  export declare const invalidChangeGroupOverlapsWithFM = "The valid time of a change group cannot overlap with the valid time of a following FM group. This change group should end before or at the hour of the start of the FM group";
14
15
  export declare const validateValidField: (value: string, tafStart: string, tafEnd: string) => boolean | string;
15
16
  export declare const validateValidChangeGroupInterField: (value: string, valueChange: string, valueProb: string, tafStart: string, tafEnd: string) => boolean | string;