From 59c6fdbd44b6cbfd9ed5e7e079b3ae4076cc03dd Mon Sep 17 00:00:00 2001 From: Michael Joyce Date: Fri, 5 Mar 2021 14:32:55 -0800 Subject: [PATCH] Issue #196 - Fix UI Time64 decode handling of 0 value Update Time64 decode function's handling of non-float values to prevent a bogus Date object being created. Resolve #196 --- ait/gui/static/js/ait/dtype.js | 8 +++++++- ait/gui/static/package-lock.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ait/gui/static/js/ait/dtype.js b/ait/gui/static/js/ait/dtype.js index 7d6a06fe..04f49235 100644 --- a/ait/gui/static/js/ait/dtype.js +++ b/ait/gui/static/js/ait/dtype.js @@ -206,7 +206,13 @@ class Time32Type extends TimeType class Time64Type extends TimeType { decode (raw) { - const parts = String(raw).split('.').map(x => parseInt(x)) + let parts = [0, 0] + if (raw % 1 === 0) { + parts = [parseInt(raw), 0] + } else { + parts = String(raw).split('.').map(x => parseInt(x)) + } + return new Date(GPSEpoch + (parts[0] * 1000) + (parts[1] / 1e6)) } } diff --git a/ait/gui/static/package-lock.json b/ait/gui/static/package-lock.json index 134062fb..82dddab0 100644 --- a/ait/gui/static/package-lock.json +++ b/ait/gui/static/package-lock.json @@ -1,6 +1,6 @@ { "name": "ait-gui", - "version": "2.1.0", + "version": "2.2.2", "lockfileVersion": 1, "requires": true, "dependencies": {