---
title: "Datetime-local: Fehlermeldung beim Validieren"
url: "https://www.typo3.net/d/125792-datetime-local-fehlermeldung-beim-validieren"
source: "typo3.net"
tags: ["Extensions","Extbase","Frage"]
created: "2017-03-08"
last_reply: "2017-03-22"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# Datetime-local: Fehlermeldung beim Validieren

Extensions › Extbase · 2 Antworten · gestartet 2017-03-08

## Eröffnungsbeitrag

**getit** · 2017-03-08 · [Beitrag #1](https://www.typo3.net/d/125792-datetime-local-fehlermeldung-beim-validieren/1)

Ich habe ein ähnliches Problem wie im Thread '@validate DateTime NUR Time'. Ich habe auch in diesem Thread gepostet. Aber da der Thread als erledigt markiert war, hab ich einen neuen aufgemacht - sorry für den Doppelpost.

Also ich habe ein Datetime-local-Feld in meinem Formular. Wenn ich das Formular abschicke erhalte ich eine Fehlermeldung: The date "2017-02-01T01:01" was not recognized (for format "d.m.Y H:i" ). | 1307719788 | Arguments: 2017-02-01T01:01

Im Controller:

```php
public function initializeAddAction() {
  $this->arguments['blog']
    ->getPropertyMappingConfiguration()
    ->forProperty('date')
    ->setTypeConverterOption(\TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::class, \TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'd.m.Y H:i');
}
```

und

```php
/**
 * @param Blog|null $blog
 */
public function addFormAction(Blog $blog = null) {
  $this->view->assign('blog', $blog);
}
/**
 * @param Blog $blog
 */
public function addAction(Blog $blog) {
  $this->blogRepository->add($blog);
  $this->redirect('list');
}
```

und im Form, als Test nur:

```html
f:form action="add" object="{blog}" name="blog" additionalAttributes="{role:'form'}">
<div class="form-group">
  <label>Date</label>
  <f:form.textfield property="date" class="form-control" type="datetime-local" />
</div>
```

Ich verwendet TYPO3, 7.6.15 aber auch unter der aktuellen Version funktionierts nicht.

## Antworten

### [#2](https://www.typo3.net/d/125792-datetime-local-fehlermeldung-beim-validieren/2) · pstranghoener · 2017-03-20

es gab auf google plus schon einmal eine diskussion darüber lies dir bitte mal den thread dazu durch: <https://plus.google.com/+PatrickHolz/posts/A7kKuMayeT6>

Geb gerne noch einmal durch ob es geklappt hat.

### [#3](https://www.typo3.net/d/125792-datetime-local-fehlermeldung-beim-validieren/3) · getit · 2017-03-22

Hat leider auch nicht funktioniert. Immer noch die gleiche Fehlermeldung.

Mein Formular sieht (zum Testen) so aus:

```html
<f:render partial="Error" arguments="{object:'leistung'}"/>

<f:form action="add" object="{leistung}" name="leistung" additionalAttributes="{role:'form'}">
  <div class="form-group">
    <label>Datum</label>
    <f:form.textfield property="stand" value="{f:format.date(format: 'd.m.Y H:i')}" type="datetime-local"/>
  </div>
  <f:form.submit value="Erzeugen!"/>
</f:form>
```

Und das Error-Partial, die mir den Fehler der Validierung meldet:

```html
<f:form.validationResults for="{object}">
  <f:if condition="{validationResults.flattenedErrors}">
    <div class="alert alert-danger">
      <f:for each="{validationResults.flattenedErrors}" as="errors" key="propertyPath">
        {propertyPath}
	<ul>
	  <f:for each="{errors}" as="error">
	    <li>
	      {error} | {error.code}
	      <f:if condition="{error.arguments}">
	        | Argumente:
	        <f:for each="{error.arguments}" as="argument" iteration="i">
	          {argument}
		  {f:if(condition: i.isLast, then: '', else: ', ')}
	        </f:for>
	      </f:if>
	    </li>
	  </f:for>
	</ul>
      </f:for>
    </div>
  </f:if>
</f:form.validationResults>
```

Die Ausgabe der Validierung ist:
stand
The date "2020-04-02T01:03" was not recognized (for format "Y-m-d\TH:i:sP "). | 1307719788 | Argumente: 2020-04-02T01:03 , Y-m-d\TH:i:sP

Die Fehlermeldung bleibt die Gleiche, egal ob ich in meinem Controller eine Funktion initializeAddAction()

```php
public function initializeAddAction() {
  $this->arguments['leistung']
       ->getPropertyMappingConfiguration()
       ->forProperty('date')
       ->setTypeConverterOption(\TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::class, \TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'd.m.Y H:i');
}
```

anlege.

Kennt denn niemand eine Lösung?

---

Quelle: „Datetime-local: Fehlermeldung beim Validieren“, typo3.net, https://www.typo3.net/d/125792-datetime-local-fehlermeldung-beim-validieren
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
