From e85a82eef8cffb1e79c8e83382ac7cfdd9ff025b Mon Sep 17 00:00:00 2001 From: Mauricio Alvarez Leon <65101411+BBBmau@users.noreply.github.com> Date: Thu, 16 May 2024 16:53:20 -0700 Subject: [PATCH] improve TimeFilter for custom date (#463) * prevent invalid filter from being saved * fix wrong date being used in custom date select * set end date to 23 59 59 * remove showError * indent * lint fix --------- Co-authored-by: Adeeb Shihadeh --- src/components/AppHeader/TimeFilter.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/AppHeader/TimeFilter.jsx b/src/components/AppHeader/TimeFilter.jsx index ba172af5..097648b3 100644 --- a/src/components/AppHeader/TimeFilter.jsx +++ b/src/components/AppHeader/TimeFilter.jsx @@ -106,7 +106,7 @@ class TimeSelect extends Component { changeStart(event) { if (event.target.valueAsDate) { this.setState({ - start: event.target.valueAsDate.setHours(0, 0, 0, 0), + start: new Date(event.target.valueAsDate.getUTCFullYear(), event.target.valueAsDate.getUTCMonth(), event.target.valueAsDate.getUTCDate()).getTime(), }); } } @@ -114,7 +114,7 @@ class TimeSelect extends Component { changeEnd(event) { if (event.target.valueAsDate) { this.setState({ - end: event.target.valueAsDate.setHours(23, 59, 59, 999), + end: new Date(event.target.valueAsDate.getUTCFullYear(), event.target.valueAsDate.getUTCMonth(), event.target.valueAsDate.getUTCDate(),23,59,59).getTime(), }); } } @@ -215,7 +215,7 @@ class TimeSelect extends Component {