Skip to main content
Topic: Min Date|Time (Read 1285 times) previous topic - next topic

Min Date|Time

Hi there,
I am trying to use Min Date | Time on an Add page to limit the choice of a date.
I would like the calendar to be limited to 3 weeks before "today". I checked on the flatpickr website and it seems possible (https://flatpickr.js.org/examples/#mindate-and-maxdate).

Can you help me ? what value i should enter the Min Date | Time field ?

Thanks

Re: Min Date|Time

Reply #1
Hi,
Any chances to get an aswer ?
In classic version, i have tried as mentionned on flatpicker support:
Min Date : today
Max date: new Date().fp_incr(21)

With no luck.
Thanks

Re: Min Date|Time

Reply #2
It seems like min|max date is a feature left out. For now, I will suggest you use custom code to edit the page.
<input class="form-control datepicker" required="" value="<?php  echo $this->set_field_value('expense_date',''); ?>" type="datetime" name="expense_date" placeholder="Enter Expense Date" data-min-date="<?php echo date('Y-m-d', strtotime("-12 day", time())) ?>" data-enable-time="false" data-date-format="Y-m-d" data-alt-format="F j, Y" data-inline="false" data-no-calendar="false" data-mode="single" />

You can equally look at this . https://github.com/flatpickr/flatpickr/issues/1380.

Regards