Skip to content

Commit

Permalink
Correct convertDateTime output on invalid/missing date
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Fitzgibbons <peter.fitzgibbons@gmail.com>
  • Loading branch information
pjfitzgibbons committed Dec 20, 2023
1 parent 6d20f85 commit 908a961
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/components/common/query_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const convertDateTime = (
const epochTime = myDate.getTime() / 1000.0;
return Math.round(epochTime);
}
if (formatted) return returnTime!.utc().format(PPL_DATE_FORMAT);
if (formatted) return returnTime?.utc()?.format(PPL_DATE_FORMAT);
return returnTime;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ exports[`<ParaOutput /> spec renders visualization outputs 1`] = `
class="euiText euiText--small"
style="margin-left: 9px;"
>
2020-07-21T18:37:44+00:00 - 2020-08-20T18:37:44+00:00
2020-07-21 18:37:44.710000 - 2020-07-21 18:37:44.710000
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const OutputBody = ({
const to = convertDateTime(visInput?.timeRange?.from, false, false);
const displayFrom = convertDateTime(visInput?.timeRange?.from, true) || 'Invalid date';
const displayTo = convertDateTime(visInput?.timeRange?.from, false) || 'Invalid date';
console.log('display', { displayFrom, displayTo, from, to, dateFormat });
if (typeOut !== undefined) {
switch (typeOut) {
case 'QUERY':
Expand Down

0 comments on commit 908a961

Please sign in to comment.