# Limitations on dates chosen in date input

**URL:** <https://community.silverfin.com/t/limitations-on-dates-chosen-in-date-input/1224>\
**Category:** Templates\
**Tags:** input, control\_flow, if, attribute\_date, warningtext\
**Created:** [October 1, 2018, 8:18am UTC](https://community.silverfin.com/t/limitations-on-dates-chosen-in-date-input/1224 "2018-10-01T08:18:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bart\_Verhaeghe](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bart\_Verhaeghe](https://community.silverfin.com/u/Bart_Verhaeghe)\
**Post date:** [October 1, 2018, 8:18am UTC](https://community.silverfin.com/t/limitations-on-dates-chosen-in-date-input/1224/1 "2018-10-01T08:18:19Z")

</div>

Good morning,

Is it possible to programatorically put limitations on the date range that can be chosen on a date input (e.g. when the date for a meeting has to be set within three months from now, that the calender can be manipulated to only include the days between now and three months from now)?

Thanks!

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [October 1, 2018, 12:09pm UTC](https://community.silverfin.com/t/limitations-on-dates-chosen-in-date-input/1224/2 "2018-10-01T12:09:47Z")

</div>

Hi @Bart_Verhaeghe,

Not really.

You can however, make some logic code around it to let display a warning-tag for instance:

```auto
{% comment %}create variables and output them in seconds{% endcomment %}
{% assign date_gm = period.custom.date.gm | date:"%s" %}
{% assign date_now = "now" | date:"%s" %} 
{% comment %}create difference between two dates in seconds{% endcomment %}
{% assign diff_seconds = date_gm | minus:date_now %}
{% comment %}assign variable of seconds in 3 months{% endcomment %}
{% assign three_months_in_seconds = 7889231.49 %}

{% comment %}when more than 3 months ==> create warning tag{% endcomment %}
{% if three_months_in_seconds+0 <= diff_seconds+0 %}
  {% assign check_date = true %}
{% endif %}

{% stripnewlines %}
{% input period.custom.date.gm as:date %} 
{% if check_date %}
  {% ic %}
    {::warningtext}
      Date cannot be more than 3 months
    {:/warningtext}
  {% endic %}
{% endif %}  
{% endstripnewlines %} 

```

I think you get the idea: you calculate how many seconds there are between the two dates (of course, you can convert it into months for instance) with the `%s` method (which calculates any date into seconds from a fixed date in the past).

We use the same kind of logic in one of our standard legal templates of the _special meeting_ by the way.
