Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ describe('Get Updates Tool', () => {
await expect(tool.execute({ itemId: 123, page: 0 } as any)).rejects.toThrow();
});

it('Successfully gets board updates with date range filtering', async () => {
it('Successfully gets board updates with date-only range filtering', async () => {
mocks.setResponse(mockBoardUpdatesResponse);
const tool = new GetUpdatesTool(mocks.mockApiClient);

Expand All @@ -410,7 +410,7 @@ describe('Get Updates Tool', () => {
limit: 25,
page: 1,
fromDate: '2024-01-01T00:00:00Z',
toDate: '2024-01-31T00:00:00Z',
toDate: '2024-01-31T23:59:59Z',
boardUpdatesOnly: true,
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export const getUpdatesToolSchema = {
),
};

function normalizeToISO8601DateTime(date: string): string {
function normalizeToISO8601DateTime(date: string, boundary: 'start' | 'end' = 'start'): string {
if (/^\d{4}-\d{2}-\d{2}$/.test(date)) {
return `${date}T00:00:00Z`;
return boundary === 'end' ? `${date}T23:59:59Z` : `${date}T00:00:00Z`;
}
return date;
}
Expand Down Expand Up @@ -110,7 +110,12 @@ export class GetUpdatesTool extends BaseMondayApiTool<typeof getUpdatesToolSchem
...variables,
boardId: input.objectId,
boardUpdatesOnly: !(input.includeItemUpdates ?? false),
...(input.fromDate && input.toDate ? { fromDate: normalizeToISO8601DateTime(input.fromDate), toDate: normalizeToISO8601DateTime(input.toDate) } : {}),
...(input.fromDate && input.toDate
? {
fromDate: normalizeToISO8601DateTime(input.fromDate, 'start'),
toDate: normalizeToISO8601DateTime(input.toDate, 'end'),
}
: {}),
});
}

Expand Down