@@ -33,8 +33,6 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSucce
33
33
const queryClient = useQueryClient ( ) ;
34
34
const [ error , setError ] = useState < unknown > ( undefined ) ;
35
35
36
- const [ dateValidationError , setDateValidationError ] = useState < unknown > ( undefined ) ;
37
-
38
36
const onSuccess = async ( ) => {
39
37
const queryKeys = [
40
38
[ useDagServiceGetDagsKey ] ,
@@ -65,38 +63,10 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSucce
65
63
const triggerDagRun = ( dagRunRequestBody : DagRunTriggerParams ) => {
66
64
const parsedConfig = JSON . parse ( dagRunRequestBody . conf ) as Record < string , unknown > ;
67
65
68
- const DataIntervalStart = dagRunRequestBody . dataIntervalStart
69
- ? new Date ( dagRunRequestBody . dataIntervalStart )
70
- : undefined ;
71
- const DataIntervalEnd = dagRunRequestBody . dataIntervalEnd
72
- ? new Date ( dagRunRequestBody . dataIntervalEnd )
73
- : undefined ;
74
-
75
- if ( Boolean ( DataIntervalStart ) !== Boolean ( DataIntervalEnd ) ) {
76
- setDateValidationError ( {
77
- body : {
78
- detail :
79
- "Either both Data Interval Start Date and End Date must be provided, or both must be empty." ,
80
- } ,
81
- } ) ;
82
-
83
- return ;
84
- }
85
-
86
- if ( DataIntervalStart && DataIntervalEnd ) {
87
- if ( DataIntervalStart > DataIntervalEnd ) {
88
- setDateValidationError ( {
89
- body : {
90
- detail : "Data Interval Start Date must be less than or equal to Data Interval End Date." ,
91
- } ,
92
- } ) ;
93
-
94
- return ;
95
- }
96
- }
66
+ const logicalDate = dagRunRequestBody . logicalDate ? new Date ( dagRunRequestBody . logicalDate ) : undefined ;
97
67
98
- const formattedDataIntervalStart = DataIntervalStart ?. toISOString ( ) ?? undefined ;
99
- const formattedDataIntervalEnd = DataIntervalEnd ?. toISOString ( ) ?? undefined ;
68
+ // eslint-disable-next-line unicorn/no-null
69
+ const formattedLogicalDate = logicalDate ?. toISOString ( ) ?? null ;
100
70
101
71
const checkDagRunId = dagRunRequestBody . dagRunId === "" ? undefined : dagRunRequestBody . dagRunId ;
102
72
const checkNote = dagRunRequestBody . note === "" ? undefined : dagRunRequestBody . note ;
@@ -106,13 +76,11 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { dagId: string; onSucce
106
76
requestBody : {
107
77
conf : parsedConfig ,
108
78
dag_run_id : checkDagRunId ,
109
- data_interval_end : formattedDataIntervalEnd ,
110
- data_interval_start : formattedDataIntervalStart ,
111
- logical_date : null ,
79
+ logical_date : formattedLogicalDate ,
112
80
note : checkNote ,
113
81
} ,
114
82
} ) ;
115
83
} ;
116
84
117
- return { dateValidationError , error, isPending, triggerDagRun } ;
85
+ return { error, isPending, triggerDagRun } ;
118
86
} ;
0 commit comments