fluidtypo3-7.6.x

Datepicker in fluid typo3


I am working with a typo3 extbase extension and I got stuck with this particular point. Can we have a typo3 fluid equivalent for

<input type="date" />

I need to have a date picker in my extension. Is it possible with typo3 fluid?


Solution

  • Update for 10.4:

    Add the datepicker module to your extension (ext_localconf.php):

    if(TYPO3_MODE === 'BE'){
        $pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker');
    }
    

    Then you can use this Fluid in a TYPO3 Backend Module:

    <div class="input-group">
       <input type="text" id="my-unique-identifier"
              class="t3js-datetimepicker form-control t3js-clearable hasDefaultValue" data-date-type="date"
              data-formengine-input-name="my-input-field-name"
              data-formengine-input-initialized="true">
       <span class="input-group-btn">
           <label class="btn btn-default" for="my-unique-identifier">
              <core:icon identifier="actions-calendar-alternative" size="small" />
           </label>
       </span>
    </div>
    

    The value data-date-type can be set to "date" or "datetime".

    Don't forget to add core namespace to your Fluid template for the Icon API:

    <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
      data-namespace-typo3-fluid="true">