File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
components/rumi_ai/actions/create-session Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,20 @@ export default {
7171 summaAI,
7272 } = this ;
7373
74- // Convert date/time inputs to Unix timestamps
75- // Note: For proper timezone handling, we'd need a library like date-fns-tz
76- // For now, treating input as local time
74+ // Convert date/time inputs to Unix timestamps with validation
7775 const startDateTime = new Date ( `${ startDate } T${ startTime } :00` ) ;
7876 const endDateTime = new Date ( `${ endDate || startDate } T${ endTime } :00` ) ;
77+
78+ // Validate dates
79+ if ( isNaN ( startDateTime . getTime ( ) ) ) {
80+ throw new Error ( "Invalid start date/time provided" ) ;
81+ }
82+ if ( isNaN ( endDateTime . getTime ( ) ) ) {
83+ throw new Error ( "Invalid end date/time provided" ) ;
84+ }
85+ if ( endDateTime <= startDateTime ) {
86+ throw new Error ( "End time must be after start time" ) ;
87+ }
7988
8089 // Convert to Unix timestamps (seconds since epoch)
8190 const startTimestamp = Math . floor ( startDateTime . getTime ( ) / 1000 ) ;
You can’t perform that action at this time.
0 commit comments