patch date filter

This commit is contained in:
Maidul Islam
2024-06-14 20:56:47 -04:00
parent a332019c25
commit ae177343d5
3 changed files with 7 additions and 4 deletions

View File

@@ -143,7 +143,8 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
projectId: req.params.workspaceId,
...req.query,
startDate: req.query.endDate || getLastMidnightDateISO(),
endDate: req.query.endDate,
startDate: req.query.startDate || getLastMidnightDateISO(),
auditLogActor: req.query.actor,
actor: req.permission.type
});

View File

@@ -179,8 +179,9 @@ export const LogsFilter = ({ control, reset }: Props) => {
<FormControl label="End date" errorText={error?.message} isError={Boolean(error)}>
<DatePicker
value={field.value || undefined}
onChange={(date) => {
onChange(date);
onChange={(pickedDate) => {
pickedDate?.setHours(23, 59, 59, 999); // we choose the end of today not the start of it (going off of aws cloud watch)
onChange(pickedDate);
setIsEndDatePickerOpen(false);
}}
popUpProps={{

View File

@@ -23,7 +23,8 @@ export const LogsSection = () => {
defaultValues: {
page: 1,
perPage: 10,
startDate: new Date(new Date().setDate(new Date().getDate() - 1))
startDate: new Date(new Date().setDate(new Date().getDate() - 1)), // day before today
endDate: new Date(new Date(Date.now()).setHours(23, 59, 59, 999)) // end of today
}
});