Set default date/time in Mautic Form Field

Your software
My Mautic version is: 4.4.7
My PHP version is: 7.4.33
My Database type and version is: MySQL 5.7.36

Your problem
My problem is: I need to set a default date and time on a read-only field in a Mautic form

These errors are showing in the log: Not applicable

Steps I have tried to fix the problem: I have tried setting a string value for date and time, as well as trying a UNIX time stamp, in the Default Value for a custom Date/Field time. It does not default a date in the Javascript date picker.

Does anyone know how to go about doing this? Thanks!

Hi @deejmer ,
Just an idea, that I haven’t tested.

This allows you to overwrite data, maybe you can use the TWIG syntax to save the current timestamp.

That’s an interesting idea/plugin. I don’t need the CURRENT time stamp. This is for an event registration - the idea is to default to a date and make it read only so it’s saved to the DB and also shown to the user. Was hoping to find a javascript hack or something, but unsure which JS library is even being used for that date/time field control…

Oh ok, I misunderstood.
The most obvious solution would be to embed the form by copying the js and html where you modify the html by hardcoding the placeholder value.

I wasn’t able to figure it out with that idea, but I did find a solution. It turned out I just hadn’t tried enough date formats. Once I made the default date/time this format: YYYY-MM-DD HH:MM (or 2023-04-25 14:00), it took! Thanks for your suggestions!