diff --git a/public/js/src_modules/aggregate.mjs b/public/js/src_modules/aggregate.mjs index 6691c1c3f1838999a8ae84d78277a94ae46df64a..97c2c07244f00b0303f594932b891e7ebc921e4b 100644 --- a/public/js/src_modules/aggregate.mjs +++ b/public/js/src_modules/aggregate.mjs @@ -5,6 +5,28 @@ import { extractObservationValuesWithinMonthInterval, } from "./aggregateHelpers.mjs"; +/** + * Calculate the minimum observation values that fall within a time interval delimited by a start date and end date + * @param {Array} obsValuesForDaysIntervalArr An array of observation values that fall within our time interval + * @returns {Number} A floating-point number representing the minimum of observation values + */ +const calculateMinimumObservationValuesWithinDatesInterval = function ( + obsValuesForDaysIntervalArr +) { + return Math.min(...obsValuesForDaysIntervalArr); +}; + +/** + * Calculate the maximum observation values that fall within a time interval delimited by a start date and end date + * @param {Array} obsValuesForDaysIntervalArr An array of observation values that fall within our time interval + * @returns {Number} A floating-point number representing the maximum of observation values + */ +const calculateMaximumObservationValuesWithinDatesInterval = function ( + obsValuesForDaysIntervalArr +) { + return Math.max(...obsValuesForDaysIntervalArr); +}; + /** * Calculate the sum of observation values that fall within a time interval delimited by a start date and end date * @param {Array} obsValuesForDaysIntervalArr An array of observation values that fall within our time interval