Skip to content

Commit

Permalink
Issue #196 - Fix UI Time64 decode handling of 0 value
Browse files Browse the repository at this point in the history
Update Time64 decode function's handling of non-float values to prevent a
bogus Date object being created.

Resolve #196
  • Loading branch information
MJJoyce committed Mar 6, 2021
1 parent 6a71964 commit 59c6fdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ait/gui/static/js/ait/dtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down
2 changes: 1 addition & 1 deletion ait/gui/static/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59c6fdb

Please sign in to comment.