diff --git a/backend/src/utils/validation.js b/backend/src/utils/validation.js index 6f1e5df..bf99012 100644 --- a/backend/src/utils/validation.js +++ b/backend/src/utils/validation.js @@ -26,8 +26,11 @@ const refreshSchema = z.object({ const createEntrySchema = z.object({ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be YYYY-MM-DD') .refine(val => { - const entryDate = new Date(val + 'T23:59:59Z'); - return entryDate <= new Date(); + // Allow today + past dates. Compare date-only (ignore time). + // Use T12:00 to avoid timezone edge cases. + const today = new Date(); + const todayStr = today.toISOString().split('T')[0]; + return val <= todayStr; }, { message: 'Cannot create entries for future dates' }), homeownerId: z.string().uuid('Invalid homeowner ID'), hoursWorked: z