When filtering collections by datetime fields (e.g., createdAt) in the admin panel, only the date can be customized. The time defaults to the current time, preventing precise datetime filtering. We need a way to specify both custom date and time in filters for more accurate data querying. Is there a built-in solution or a recommended approach to achieve this functionality?
#Custom time selection for date filters in admin panel
8 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
If this option is not available, it seems like more of a bug than a feature request
I would make a post here https://github.com/payloadcms/payload/issues/new/choose
I'm not sure of a workaround for the time being, but I can look into it
Actually, this may be doable by adjusting the react-datpicker config https://github.com/Hacker0x01/react-datepicker/blob/main/docs/datepicker.md
@sharp sparrow Thank you for your answer but can you tell me how should i change the configuration of the default react date picker in payload for the auto generated timestamps. Those configuration seem to be not available for auto generated timestamps
The solution is to override the configuration for these fields in your collection schema.It will not affect the auto generation of this field and Here's how you can modify the createdAt field (and you can do the same for updatedAt):
{
name: "createdAt",
type: "date",
admin: {
hidden: true,
date: {
pickerAppearance: "dayAndTime",
},
},
},