Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: pad calendar days

Scott Wilsonfe5e2238356a
diff --git a/backend/src/ee/services/insights/insights-service.ts b/backend/src/ee/services/insights/insights-service.ts
index 99d1bdd1d2..3d24753e95 100644
--- a/backend/src/ee/services/insights/insights-service.ts
+++ b/backend/src/ee/services/insights/insights-service.ts
@@ -98,8 +98,10 @@ export const insightsServiceFactory = ({
const { shouldUseSecretV2Bridge } = await projectBotService.getBotKey(dto.projectId);
if (!shouldUseSecretV2Bridge) throw new BadRequestError({ message: "Project version not supported" });
- const startDate = new Date(Date.UTC(dto.year, dto.month - 1, 1));
- const endDate = new Date(Date.UTC(dto.year, dto.month, 0, 23, 59, 59, 999));
+ // Pad by 1 day on each side so events near month boundaries are captured
+ // regardless of the caller's timezone offset from UTC.
+ const startDate = new Date(Date.UTC(dto.year, dto.month - 1, 0));
+ const endDate = new Date(Date.UTC(dto.year, dto.month, 1, 23, 59, 59, 999));
const [rotations, reminders] = await Promise.all([
secretRotationV2DAL.findByProjectAndDateRange({ projectId: dto.projectId, startDate, endDate }),