use regular WTForms DateField for requests dates
This commit is contained in:
10
templates/components/date_input.html
Normal file
10
templates/components/date_input.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% from "components/text_input.html" import TextInput %}
|
||||
|
||||
{% macro DateInput(field, tooltip='', placeholder='', validation='anything', paragraph=False) -%}
|
||||
{% if field.data %}
|
||||
{% set input_value=field.data.strftime("%m/%d/%Y") %}
|
||||
{% else %}
|
||||
{% set input_value=None %}
|
||||
{% endif %}
|
||||
{{ TextInput(field, initial_value=input_value, tooltip=tooltip, placeholder=placeholder, validation=validation, paragraph=paragraph) }}
|
||||
{% endmacro %}
|
||||
@@ -1,12 +1,12 @@
|
||||
{% from "components/icon.html" import Icon %}
|
||||
{% from "components/tooltip.html" import Tooltip %}
|
||||
|
||||
{% macro TextInput(field, tooltip='', placeholder='', validation='anything', paragraph=False) -%}
|
||||
{% macro TextInput(field, tooltip='', placeholder='', validation='anything', paragraph=False, initial_value='') -%}
|
||||
<textinput
|
||||
name='{{ field.name }}'
|
||||
validation='{{ validation }}'
|
||||
{% if paragraph %}paragraph='true'{% endif %}
|
||||
{% if field.data %}initial-value='{{ field.data }}'{% endif %}
|
||||
{% if initial_value or field.data %}initial-value='{{ initial_value or field.data }}'{% endif %}
|
||||
{% if field.errors %}v-bind:initial-errors='{{ field.errors }}'{% endif %}
|
||||
key='{{ field.name }}'
|
||||
inline-template>
|
||||
|
||||
Reference in New Issue
Block a user