Default time for a datetime field?

Hi,

I’m a new user of Directus and I would like to know if it’s possible to change the default time for the datetime fields? I would like something else thant 12:00:00
I haven’t found any settings about that, I found it could be possible by using a hook during the creation of a new entity but I would prefer that the user could see the default time inside the datetime field.

Thanks.

2 Answers

2

Thanks for your answer bryantgillespie. You understood my request well, my goal is the 1st case : “Set a default time that appears in the datetime picker when creating new items” I think it’s possible to do it with a custom extension field based on the regular datetime field. I’m working on that…

hi Sebastien, can you share how to using a hook to change the default time? or maybe there is a way change the default time setting by change the database setting? I have the same requirement for that and I want to do this by update some db data, but I cannot find where, not sure you if know something about this, thx!

I think you’re asking to set a default for the time within the UI when it opens, and that’s currently not possible.

Now, you could certainly use a custom hook or flow to set an actual default time when it gets saved to the database. But I don’t think that’s what you’re looking for here.

Maybe you could clarify what you’re trying to accomplish? Are you looking to:

  • Set a default time that appears in the datetime picker when creating new items?
  • Or automatically populate the field with a specific time when the record is saved?

The approach would be different depending on your specific use case.