I need to create a custom contact form in Drupal 8. I wrote all the code to build the form. I just need to set the default value for a datetime form element.
The code I am using to add that form element is the following one.
$form['start_date'] = [
'#type' => 'datetime',
'#title' => t('Start date'),
'#default_value' => time(),
];
The value I am using for the default value doesn't show the expected value. What should I use instead of time()
?