Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/www/static/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ function groupTooltip(node, tis) {
}
});

const groupDuration = convertSecsToHumanReadable(moment(maxEnd).diff(minStart, 'second'));
const groupDuration = convertSecsToHumanReadable(moment(maxEnd).diff(minStart, 'second', true));
const tooltipText = node.tooltip ? `<p>${node.tooltip}</p>` : '';

let tt = `
Expand Down
4 changes: 2 additions & 2 deletions airflow/www/static/js/task_instances.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export default function tiTooltip(ti, { includeTryNumber = false } = {}) {
// Calculate duration on the fly if task instance is still running
if (ti.state === 'running') {
const startDate = ti.start_date instanceof moment ? ti.start_date : moment(ti.start_date);
ti.duration = moment().diff(startDate, 'second');
ti.duration = moment().diff(startDate, 'second', true);
} else if (!ti.duration && ti.end_date) {
const startDate = ti.start_date instanceof moment ? ti.start_date : moment(ti.start_date);
const endDate = ti.end_date instanceof moment ? ti.end_date : moment(ti.end_date);
ti.duration = moment(endDate).diff(startDate, 'second');
ti.duration = moment(endDate).diff(startDate, 'second', true);
}

tt += `Duration: ${escapeHtml(convertSecsToHumanReadable(ti.duration))}<br>`;
Expand Down
1 change: 1 addition & 0 deletions newsfragments/23173.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug where task run duration would not be displayed properly when duration is less than 1 second