Skip to content

Commit

Permalink
fix(ui): date parsing should not apply for number (#1071)
Browse files Browse the repository at this point in the history
close #1070
  • Loading branch information
brian-mulier-p authored Mar 23, 2023
1 parent 900d38c commit 558c41e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ui/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,23 @@ export default class Utils {
const flat = Utils.flatten(data);

return Object.keys(flat).map(key => {
let rawValue = flat[key];
if (key === "variables.executionId") {
return {key, value: flat[key], subflow: true};
return {key, value: rawValue, subflow: true};
}

if (typeof (flat[key]) === "string") {
let date = moment(flat[key], moment.ISO_8601);
if (typeof rawValue === "string" && rawValue.match(/\d{4}-\d{2}-\d{2}/)) {
let date = moment(rawValue, moment.ISO_8601);
if (date.isValid()) {
return {key, value: flat[key], date: true};
return {key, value: rawValue, date: true};
}
}

if (typeof (flat[key]) === "number") {
return {key, value: Utils.number(flat[key])};
if (typeof rawValue === "number") {
return {key, value: Utils.number(rawValue)};
}

return {key, value: flat[key]};
return {key, value: rawValue};

})
}
Expand Down

0 comments on commit 558c41e

Please sign in to comment.