Title: datepicker 2 fields
Last modified: December 6, 2022

---

# datepicker 2 fields

 *  Resolved [martiv97](https://wordpress.org/support/users/martiv97/)
 * (@martiv97)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/)
 * Hello there,
    I would like to ask you for a solution to this matter. I have 2
   datepicker fields – one for arrival and second for departure. It is working now
   of course but its not connected. When I choose 6th Dec on arrival I can still
   choose date before arrival on departure field which does not really make sense.
   Is there any solution to this so I can only choose date equal or after 6th Dec?
   Thank you!
 * EDIT: I have found this example using flatpickr but I have no idea how to implement
   this. I do have PRO version.
    [https://formvalidation.io/guide/examples/using-flatpickr-for-start-and-end-dates/](https://formvalidation.io/guide/examples/using-flatpickr-for-start-and-end-dates/)
    -  This topic was modified 3 years, 6 months ago by [martiv97](https://wordpress.org/support/users/martiv97/).
    -  This topic was modified 3 years, 6 months ago by [martiv97](https://wordpress.org/support/users/martiv97/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Tahmid ul Karim](https://wordpress.org/support/users/tahmidulkarim/)
 * (@tahmidulkarim)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16267328)
 * Hi [@martiv97](https://wordpress.org/support/users/martiv97/),
 * You can add the following code in the advanced date configuration section of 
   the first date field (arrival field) –
 *     ```
       {
       onChange: function(selectedDates, dateStr) {
              var date = selectedDates[0];
   
              date.setDate(date.getDate());
   
              flatpickr('.endDate', {
               minDate: date,
       });
           }
       }
       ```
   
 * Also, in the second date field (departure field) add the class **endDate** as
   the Element class in that field.
 * That should allow you to only choose the date in the departure field after or
   equal to the arrival date.
 * I hope this is what you are looking for.
 * Thank you.
 *  Thread Starter [martiv97](https://wordpress.org/support/users/martiv97/)
 * (@martiv97)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16268045)
 * Excellent! Thank you it is working. But is it possible to change format to dd/
   mm/yyyy instead of yyyy/mm/dd? My departure field changed its format after that.
    -  This reply was modified 3 years, 6 months ago by [martiv97](https://wordpress.org/support/users/martiv97/).
    -  This reply was modified 3 years, 6 months ago by [martiv97](https://wordpress.org/support/users/martiv97/).
 *  [Tahmid ul Karim](https://wordpress.org/support/users/tahmidulkarim/)
 * (@tahmidulkarim)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16270609)
 * Hi [@martiv97](https://wordpress.org/support/users/martiv97/),
 * Glad to hear that the code is working.
 * You can change the date format of the departure field by adding the date format(
   dateFormat: “d/m/Y”) directly in the code.
 * This is the updated code –
 *     ```
       {
       onChange: function(selectedDates, dateStr) {
              var date = selectedDates[0];
   
              date.setDate(date.getDate());
   
              flatpickr('.endDate', {
               minDate: date,
               dateFormat: "d/m/Y",
       });
           }
       }
       ```
   
 * Thank you!
 *  Thread Starter [martiv97](https://wordpress.org/support/users/martiv97/)
 * (@martiv97)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16271482)
 * You’re the legend. Thank you!
 *  [Tahmid ul Karim](https://wordpress.org/support/users/tahmidulkarim/)
 * (@tahmidulkarim)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16273830)
 * Hi [@martiv97](https://wordpress.org/support/users/martiv97/),
 * I am happy to help!
 * We would very much appreciate it if you could spare a few minutes to share your
   experience and provide us with a review if you haven’t done it already.
 * This feedback helps us improve our ability to provide you with the best possible
   support.
 * To write a review, please visit here: [https://wordpress.org/support/plugin/fluentform/reviews/#new-post](https://wordpress.org/support/plugin/fluentform/reviews/#new-post)
 * Thank you!
 *  Thread Starter [martiv97](https://wordpress.org/support/users/martiv97/)
 * (@martiv97)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16274603)
 * Sure you got it! The least I can do.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘datepicker 2 fields’ is closed to new replies.

 * ![](https://ps.w.org/fluentform/assets/icon-256x256.png?rev=3354580)
 * [Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder](https://wordpress.org/plugins/fluentform/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fluentform/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fluentform/)
 * [Active Topics](https://wordpress.org/support/plugin/fluentform/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fluentform/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fluentform/reviews/)

## Tags

 * [datepicker](https://wordpress.org/support/topic-tag/datepicker/)

 * 6 replies
 * 2 participants
 * Last reply from: [martiv97](https://wordpress.org/support/users/martiv97/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/datepicker-2-fields/#post-16274603)
 * Status: resolved