fix(cortex): update date handling in API and UI components
- Adjusted date handling in the agenda API to ensure optional parameters for start, end, and label are correctly processed. - Enhanced chat input and action parser to support optional date labels for relative dates. - Updated agenda components to handle date ranges and loading states more effectively. - Improved error handling and loading indicators in the agenda block for better user experience. This commit ensures consistency in date handling across the application, aligning with the new requirements for relative date inputs.
This commit is contained in:
@@ -42,10 +42,11 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
// Parse and validate query parameters
|
||||
// Note: searchParams.get() returns null if not present, but Zod expects undefined
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
const start = searchParams.get('start');
|
||||
const end = searchParams.get('end');
|
||||
const label = searchParams.get('label');
|
||||
const start = searchParams.get('start') ?? undefined;
|
||||
const end = searchParams.get('end') ?? undefined;
|
||||
const label = searchParams.get('label') ?? undefined;
|
||||
|
||||
const validation = QuerySchema.safeParse({ start, end, label });
|
||||
if (!validation.success) {
|
||||
|
||||
Reference in New Issue
Block a user