{% extends "forms/field.html.twig" %}

{% set php_dateformat = config.system.pages.dateformat.default ?: "d-m-Y H:i" %}
{% set js_dateformat = admin.dateformat2Kendo(php_dateformat) %}
{% set value = (value is null ? value : value|date(php_dateformat)) %}


{% block input_attributes %}
    type="date"
    data-grav-field-datetime
    data-date-formats="{{ {'format': js_dateformat} | json_encode | e('html_attr') }}"
    {% if field.validate.min %}min="{{ (field.validate.min is null ? field.validate.min : field.validate.min|date(php_dateformat)) }}"{% endif %}
    {% if field.validate.max %}max="{{ (field.validate.max is null ? field.validate.max : field.validate.max|date(php_dateformat)) }}"{% endif %}
    {{ parent() }}
{% endblock %}

{% extends "forms/field.html.twig" %}

{% block input_attributes %}
    type="date"
    data-grav-field-datetime
    {% if field.validate.min %}min="{{ (field.validate.min is null ? field.validate.min : field.validate.min|date("d-m-Y H:i")) }}"{% endif %}
    {% if field.validate.max %}max="{{ (field.validate.max is null ? field.validate.max : field.validate.max|date("d-m-Y H:i")) }}"{% endif %}
    {{ parent() }}
{% endblock %}

Revert "datetime format set by phpformat"
Revert "datetime format set by phpformat"

This reverts commit d4234e4be13da5e24fe5561eed7803cce487b702.
