From 4822919aa40e8c41da7bc4479ef095976bd97b95 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Mon, 3 Mar 2025 18:11:16 +0100 Subject: [PATCH] fix .median sort function (#8971) --- core/modules/filters/math.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/filters/math.js b/core/modules/filters/math.js index ed8e5eed6..6b1d45f08 100644 --- a/core/modules/filters/math.js +++ b/core/modules/filters/math.js @@ -128,7 +128,7 @@ exports.minall = makeNumericReducingOperator( exports.median = makeNumericArrayOperator( function(values) { var len = values.length, median; - values.sort(); + values.sort(function(a,b) {return a-b}); if(len % 2) { // Odd, return the middle number median = values[(len - 1) / 2];