automatic closing time with door sensor

Good morning, it would be interesting for those like me who also have a door sensor to implement the ability to lock the door as soon as the door is closed. Currently, the maximum allowed is 30 minutes after you close the door…but I want to be able to set time slots, perhaps weekly. For example: I want to lock the door after closing it within 10 seconds from 10 PM to 6 AM. Enabled every day or specific days of the week. Obviously, for those who have a door sensor.