From e4cee7ee0d9ee4dfe3dcd2ba99f7bd1f6b3d38e4 Mon Sep 17 00:00:00 2001 From: James Wing Date: Wed, 1 Feb 2017 17:52:28 -0800 Subject: [PATCH] NIFI-3427 Fix Provenance DateTime Sorting This closes #1465. --- .../src/main/webapp/js/nf/nf-common.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js index 7ae237aa4e..395b5c886f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js @@ -1040,14 +1040,20 @@ if (date.length !== 3 || time.length !== 3) { return new Date(); } + var year = parseInt(date[2], 10); + var month = parseInt(date[0], 10) - 1; // new Date() accepts months 0 - 11 + var day = parseInt(date[1], 10); + var hours = parseInt(time[0], 10); + var minutes = parseInt(time[1], 10); // detect if there is millis - var seconds = time[2].split(/\./); - if (seconds.length === 2) { - return new Date(parseInt(date[2], 10), parseInt(date[0], 10), parseInt(date[1], 10), parseInt(time[0], 10), parseInt(time[1], 10), parseInt(seconds[0], 10), parseInt(seconds[1], 10)); - } else { - return new Date(parseInt(date[2], 10), parseInt(date[0], 10), parseInt(date[1], 10), parseInt(time[0], 10), parseInt(time[1], 10), parseInt(time[2], 10), 0); + var secondsSpec = time[2].split(/\./); + var seconds = parseInt(secondsSpec[0], 10); + var milliseconds = 0; + if (secondsSpec.length === 2) { + milliseconds = parseInt(secondsSpec[1], 10); } + return new Date(year, month, day, hours, minutes, seconds, milliseconds); }, /**