1

Using Drupal Console, I created a custom content entity in which there is a 'date' field:

$fields['subscription_date'] = BaseFieldDefinition::create('datetime')  
  ->setLabel(t('Date souscription'))  
  ->setSetting('datetime_type', 'date')  
  ->setDefaultValue(array(0 => array(  
    'default_date_type' => 'now',  
    'default_date' => 'now',  
  )))  

The edit-form works as supposed and, particularly, editing 'subscription_date' brings up the calendar popup:
enter image description here
In my custom module, I defined a table form to 'mass' edit this entity:
I defined the date field in the form this way:

$form['souscriptions'][$key]['date'] = array(  
    '#type' => 'date',  
    '#default_value' => $default_value,  
);  

In Firefox, it looks like:
enter image description here and editing a date field doesn't show the date popup :-(
While in Chrome, it's OK:
enter image description here Any idea why?
What should I add to my form to have at least the simple calendar popup I have in my content entity edit-form?

Forgot to say: i'm using Drupal 8.4.2

2 Answers 2

1

This issue is coming because of jQuery confliction. Either you can update jQuery version or find out the confliction of jquery object.

0

The reason is because at the time you asked this question, Firefox did not implement HTML5 date popup picker yet. As of right now Firefox already has it, but Safari for example still does not. To make the calendar popup work on browsers like Safari you would need some sort of a JavaScript solution such as jQuery UI date picker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.