From 24c738c6d8bf165795203418ee2e6e04995fedae Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 27 Mar 2020 09:37:32 -0400 Subject: [PATCH] Moves generation of today and tomorrow strings out of the return of the ScheduleForm --- .../src/components/Schedule/shared/ScheduleForm.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/awx/ui_next/src/components/Schedule/shared/ScheduleForm.jsx b/awx/ui_next/src/components/Schedule/shared/ScheduleForm.jsx index 598192aa80..b360232d3b 100644 --- a/awx/ui_next/src/components/Schedule/shared/ScheduleForm.jsx +++ b/awx/ui_next/src/components/Schedule/shared/ScheduleForm.jsx @@ -121,6 +121,13 @@ function ScheduleForm({ submitError, ...rest }) { + const now = new Date(); + const closestQuarterHour = new Date( + Math.ceil(now.getTime() / 900000) * 900000 + ); + const tomorrow = new Date(closestQuarterHour); + tomorrow.setDate(tomorrow.getDate() + 1); + const { request: loadZoneInfo, error: contentError, @@ -154,12 +161,6 @@ function ScheduleForm({ return ( {() => { - const now = new Date(); - const closestQuarterHour = new Date( - Math.ceil(now.getTime() / 900000) * 900000 - ); - const tomorrow = new Date(closestQuarterHour); - tomorrow.setDate(tomorrow.getDate() + 1); return (