КОНТРОЛЫ/time_field.md


Исходный код

Twig код

{% if not time_format %}
  {% set time_format = _time_format %}
{% endif %}

{% set max_length = time_format == 12 ? 7 : 6 %}

{% if not selected_time %}
  {% set selected_time = '' %}
{% elseif selected_time == 'now' %}
  {% set selected_time = 'today'|task_date('time', true, true)|split(' ')[1] %}
{% endif %}

{% if not placeholder_time %}
  {% set placeholder_time = '' %}
{% elseif placeholder_time == 'now' %}
  {% set placeholder_time = 'today'|task_date('time', true, true)|split(' ')[1] %}
{% endif %}

<div class="time-field {{ class_name }}" data-time-format="{{ time_format }}">
  {% include "interface/controls/input.twig" with {
    class_name: 'text-input-visible-placeholder time-field-input js-control-time-field-input ' ~ input_class_name,
    name: name,
    type: 'text',
    disabled: disabled,
    placeholder: placeholder_time,
    value: selected_time,
    max_length: max_length,
  } %}
</div>

Ссылка на вики репозиторий