Title: Date issues with code snippet
Last modified: June 20, 2022

---

# Date issues with code snippet

 *  Resolved [vissersj](https://wordpress.org/support/users/vissersj/)
 * (@vissersj)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/)
 * I have tried implementing the solution provided by Erik (@codekraft) in topic
   [https://wordpress.org/support/topic/how-to-disable-exclude-specific-day-in-date-picker/](https://wordpress.org/support/topic/how-to-disable-exclude-specific-day-in-date-picker/)
   and use the code below in a CF7 form:
 *     ```
       <TABLE><TR><TD>First preferable date</TD><TD>[date* prefdate1 min:today+3days id:datepicker1]</TD></TR><TR><TD>Second preferable date</TD><TD>[date* prefdate2 min:today+3days id:datepicker2]
       <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/ui-lightness/jquery-ui.css">
       <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
       <script>
       jQuery(function($){
       $("#datepicker1").click(function(e){
            e.preventDefault();
       }).datepicker({
         dateFormat: "dd-mm-yy",
         beforeShowDay: function (date) {
           return ( date.getDay() === 0 || date.getDay() === 6 ) ? [false, " disabled"] : [true, " enabled"];
         }
       });
       });
       </script>
       <script>
       jQuery(function($){
       $("#datepicker2").click(function(e){
            e.preventDefault();
       }).datepicker({
         dateFormat: "dd-mm-yy",
         beforeShowDay: function (date) {
           return ( date.getDay() === 0 || date.getDay() === 6 ) ? [false, " disabled"] : [true, " enabled"];
         }
       });
       });
       </script>
       <style>
       .disabled {
         color: #000;
       }
       .enabled {
         color: #ff0000 !important;
       }
       input::-webkit-calendar-picker-indicator{
         color:red;
       }
       input[type="date"]::-webkit-calendar-picker-indicator {
         -webkit-appearance: none;
       }
       </style>
       </TD></TR></TABLE>
       ```
   
 * Though I have two issues:
 * 1) min:today+3days isn’t working, how can I make that work?
    2) the date picker
   is in English, how can I get it in Dutch language?

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

 *  [Erik](https://wordpress.org/support/users/codekraft/)
 * (@codekraft)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/#post-15753798)
 * ciao [@vissersj](https://wordpress.org/support/users/vissersj/)!
 * if you mean a minimum date it should be used minDate
 *     ```
       var date = new Date();
       date.setDate(date.getDate()+3);
   
       ...
       minDate: date
       ```
   
 * (here the reference [https://api.jqueryui.com/datepicker/#option-minDate](https://api.jqueryui.com/datepicker/#option-minDate))
 * And about the dutch localization -> [https://github.com/dzhu/cs181/blob/master/hw3/tfutils/static/jqueryui/development-bundle/ui/i18n/.svn/text-base/jquery.ui.datepicker-nl.js.svn-base](https://github.com/dzhu/cs181/blob/master/hw3/tfutils/static/jqueryui/development-bundle/ui/i18n/.svn/text-base/jquery.ui.datepicker-nl.js.svn-base)
 * To localize the [datepicker](https://api.jqueryui.com/datepicker/#utility-noWeekends)
   you need set the content of the previous file [as default](https://stackoverflow.com/a/30937754/5735847)`
   $.datepicker.setDefaults({})` or load the that file then `$( yourDatePicker ).
   datepicker( $.datepicker.regional[ "nl" ] );`
    -  This reply was modified 3 years, 11 months ago by [Erik](https://wordpress.org/support/users/codekraft/).
    -  This reply was modified 3 years, 11 months ago by [Erik](https://wordpress.org/support/users/codekraft/).
    -  This reply was modified 3 years, 11 months ago by [Erik](https://wordpress.org/support/users/codekraft/).
 *  Thread Starter [vissersj](https://wordpress.org/support/users/vissersj/)
 * (@vissersj)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/#post-15755257)
 * [@codekraft](https://wordpress.org/support/users/codekraft/), thanks for helping
   me out! I figured out the language part, but I couldn’t get the minDate to work.
   Would you be so kind to point out where to put the minDate part in the code snippet?
    -  This reply was modified 3 years, 11 months ago by [vissersj](https://wordpress.org/support/users/vissersj/).
 *  [Erik](https://wordpress.org/support/users/codekraft/)
 * (@codekraft)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/#post-15756148)
 * ciao [@vissersj](https://wordpress.org/support/users/vissersj/),
    since minDate
   accepts also a number as value where “number of days from today”, may be even
   simpler than I thought…try something like below:
 *     ```
       <label>date: [date your-date id:datepicker]</label>
       <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/ui-lightness/jquery-ui.css">
       <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
       <script>
       jQuery(function($){
       $("#datepicker").click(function(e){
            e.preventDefault();
       }).datepicker({
         dateFormat: "dd-mm-yy",
         minDate: 3
       });
       });
       [submit "Submit"]
       ```
   
 *  Thread Starter [vissersj](https://wordpress.org/support/users/vissersj/)
 * (@vissersj)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/#post-15756301)
 * [@codekraft](https://wordpress.org/support/users/codekraft/) thank you so much
   for your help! I have added a , and it works like a charm!
 *     ```
       .datepicker({
         dateFormat: "yy-mm-dd",
         minDate: 3,
         beforeShowDay: $.datepicker.noWeekends
        });
       ```
   

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

The topic ‘Date issues with code snippet’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

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

 * 4 replies
 * 2 participants
 * Last reply from: [vissersj](https://wordpress.org/support/users/vissersj/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/date-issues-with-code-snippet/#post-15756301)
 * Status: resolved