<commit_before>{#=== OPTIONS ========================================================================================================#}

{% set option = {
    class:     ('form-control ' ~ field.class)|trim,
    variant:   field.variant,
    label:     field.label,
    info:      field.info|default(''),
    options:   field.options.datepicker|default(''),
    default:   (context.content.id == null and field.default) ? context.content.get(contentkey)|date('Y-m-d H:i:s') : null,
    required:  field.required|default(false),
    errortext: field.error|default(''),
} %}

{#=== INIT ===========================================================================================================#}

{% set attr_datetime = {
    id:         key,
    name:       name,
    value:      (context.content.get(contentkey) != null) ? context.content.get(contentkey)|date('Y-m-d H:i:s') : option.default,
    required:   option.required,
    class:      option.class,
    errortext:  option.errortext,
    options:    option.options,
} %}

{#=== FIELDSET =======================================================================================================#}

{% extends '_base/_fieldset.twig' %}

{% set fieldset = {
    datetime: {
    }
}%}

{% block fieldset %}
    {% if option.variant == 'inline' %}

        <label class="col-sm-3 control-label">{{ (option.info) ? macro.infopop(labelkey, option.info) : labelkey }}</label>
        <div class="col-sm-9">
            {{ macro.input_datetime(attr_datetime) }}
        </div>

    {% else %}

        <div class="col-sm-12">
            <label class="control-label">{{ (option.info) ? macro.infopop(labelkey, option.info) : labelkey }}</label>
            {{ macro.input_datetime(attr_datetime) }}
        </div>

    {% endif %}
{% endblock fieldset %}<commit_msg>Cleanup datetime field and use new fieldset definition on it<commit_after>{#=== OPTIONS ========================================================================================================#}

{% set option = {
    class:     ('form-control ' ~ field.class)|trim,
    variant:   field.variant,
    label:     field.label,
    info:      field.info|default(''),
    options:   field.options.datepicker|default(''),
    default:   (context.content.id == null and field.default) ? context.content.get(contentkey)|date('Y-m-d H:i:s') : null,
    required:  field.required|default(false),
    errortext: field.error|default(''),
} %}

{#=== INIT ===========================================================================================================#}

{% set attr_datetime = {
    id:         key,
    name:       name,
    value:      (context.content.get(contentkey) != null) ? context.content.get(contentkey)|date('Y-m-d H:i:s') : option.default,
    required:   option.required,
    class:      option.class,
    errortext:  option.errortext,
    options:    option.options,
} %}

{% set class = option.variant == 'inline' ? ['col-sm-3 control-label', 'col-sm-9'] : ['col-xs-12', 'col-xs-12'] %}

{#=== FIELDSET =======================================================================================================#}

{% extends '_base/_fieldset.twig' %}

{% block fieldset_type 'datetime' %}

{% block fieldset_label %}
    <label class="{{ class[0] }}">{{ (option.info) ? macro.infopop(labelkey, option.info) : labelkey }}</label>
{% endblock fieldset_label %}

{% block fieldset_controls %}
    <div class="{{ class[1] }}">
        {{ macro.input_datetime(attr_datetime) }}
    </div>
{% endblock fieldset_controls %}
{'fraction_non_alphanumeric': 0.3303192992370726, 'fraction_numerical': 0.003390788358293303, 'mean_word_length': 3.87603305785124, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6605838', 'n_tokens_mistral': 1075, 'n_tokens_neox': 992, 'n_words': 179}