This is an automated email from the ASF dual-hosted git repository. jhtimmins pushed a commit to branch v2-1-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 748c662d8f3a7cb8ed04ca01a900242c1aeeea9c Author: Brent Bovenzi <brent.bove...@gmail.com> AuthorDate: Mon Jun 28 11:23:19 2021 -0400 Fix calculating duration in tree view (#16695) Make sure moment doesn't default the end_date to now and show the wrong duration (cherry picked from commit f0b3345ddc489627d73d190a1401804e7b0d9c4e) --- airflow/www/static/js/tree.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/airflow/www/static/js/tree.js b/airflow/www/static/js/tree.js index 07daf0e..4bf366a 100644 --- a/airflow/www/static/js/tree.js +++ b/airflow/www/static/js/tree.js @@ -305,7 +305,11 @@ document.addEventListener('DOMContentLoaded', () => { .style('stroke-opacity', (d) => (d.external_trigger ? '0' : '1')) .on('mouseover', function (d) { // Calculate duration if it doesn't exist - const tt = tiTooltip({ ...d, duration: d.duration || moment(d.end_date).diff(d.start_date, 'seconds') }); + const tt = tiTooltip({ + ...d, + // if end_date is undefined then moment will default to now instead of null + duration: d.duration || d.end_date ? moment(d.end_date).diff(d.start_date, 'seconds') : null, + }); taskTip.direction('n'); taskTip.show(tt, this); d3.select(this).transition().duration(duration)