fix: module sidebar date select fix and code refactor (#2872)
This commit is contained in:
parent
ecea744657
commit
1c2761000a
2 changed files with 135 additions and 30 deletions
|
|
@ -112,13 +112,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
|
||||
const handleStartDateChange = async (date: string) => {
|
||||
setValue("start_date", date);
|
||||
if (
|
||||
watch("start_date") &&
|
||||
watch("end_date") &&
|
||||
watch("start_date") !== "" &&
|
||||
watch("end_date") &&
|
||||
watch("start_date") !== ""
|
||||
) {
|
||||
if (watch("start_date") && watch("end_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
||||
if (!isDateGreaterThanToday(`${watch("end_date")}`)) {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
@ -186,13 +180,7 @@ export const CycleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||
const handleEndDateChange = async (date: string) => {
|
||||
setValue("end_date", date);
|
||||
|
||||
if (
|
||||
watch("start_date") &&
|
||||
watch("end_date") &&
|
||||
watch("start_date") !== "" &&
|
||||
watch("end_date") &&
|
||||
watch("start_date") !== ""
|
||||
) {
|
||||
if (watch("start_date") && watch("end_date") && watch("start_date") !== "" && watch("start_date") !== "") {
|
||||
if (!isDateGreaterThanToday(`${watch("end_date")}`)) {
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue