Datetimepicker unable to select the todaydate












2














Datetimepicker unable select today's date.Suppose When we open the datetimepicker and change the date and select the today date it is not selected.And we used the Bootstarp datetimepicker.



$('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY",minDate:new Date()});


Thank you.










share|improve this question






















  • try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
    – Mohit Kumar
    Sep 7 '15 at 5:11










  • minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
    – J Santosh
    Sep 7 '15 at 11:36
















2














Datetimepicker unable select today's date.Suppose When we open the datetimepicker and change the date and select the today date it is not selected.And we used the Bootstarp datetimepicker.



$('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY",minDate:new Date()});


Thank you.










share|improve this question






















  • try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
    – Mohit Kumar
    Sep 7 '15 at 5:11










  • minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
    – J Santosh
    Sep 7 '15 at 11:36














2












2








2







Datetimepicker unable select today's date.Suppose When we open the datetimepicker and change the date and select the today date it is not selected.And we used the Bootstarp datetimepicker.



$('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY",minDate:new Date()});


Thank you.










share|improve this question













Datetimepicker unable select today's date.Suppose When we open the datetimepicker and change the date and select the today date it is not selected.And we used the Bootstarp datetimepicker.



$('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY",minDate:new Date()});


Thank you.







jquery datetimepicker bootstrap-datetimepicker






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 7 '15 at 4:43









vamsi kr

2111211




2111211












  • try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
    – Mohit Kumar
    Sep 7 '15 at 5:11










  • minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
    – J Santosh
    Sep 7 '15 at 11:36


















  • try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
    – Mohit Kumar
    Sep 7 '15 at 5:11










  • minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
    – J Santosh
    Sep 7 '15 at 11:36
















try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
– Mohit Kumar
Sep 7 '15 at 5:11




try this code:-$('#datetimepicker1').datetimepicker({format: "DD/MM/YYYY",startDate:new Date()});
– Mohit Kumar
Sep 7 '15 at 5:11












minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
– J Santosh
Sep 7 '15 at 11:36




minDate:new Date() allows you select today , can show your code where this is not working in a fiddle
– J Santosh
Sep 7 '15 at 11:36












4 Answers
4






active

oldest

votes


















1














You are setting the minData to new Data()



new Data() by default gives the current data.



So In your case you are not able to select not only today's date but all the past date.



So simple remove the minData parameter(as below), or use it a different way.



$('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY"});






share|improve this answer





















  • In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
    – vamsi kr
    Sep 7 '15 at 5:09












  • stackoverflow.com/questions/5511323/javascript-yesterday
    – sanjeev
    Sep 7 '15 at 5:17










  • @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
    – P_S
    Sep 7 '15 at 12:57





















1














You have to integrade use Below code to select the todaydate



minDate: new Date().setHours(0,0,0,0)



$("#startdatetimepicker").datetimepicker({ minDate : new
Date().setHours(0,0,0,0),format: 'DD-MM-YYYY'});





  • It select the today's date also after picked another date and go for select today's date.

  • It's also disable the previous date.






share|improve this answer































    0














    You should use following code.



     <script src="/assets/js/plugins/datetime/bootstrap-datetimepicker.min.js"></script> 
    $('#datetimepicker1').datetimepicker({
    weekStart: 1,
    todayBtn: 1,
    autoclose: 1,
    todayHighlight: 1,
    startView: 2,
    minView: 2,
    forceParse: 0
    });





    share|improve this answer























    • Still unable to select the today date@Singh
      – vamsi kr
      Sep 7 '15 at 5:00



















    0














    You're setting the minDate to today, which means won't be able to select it.



    Instead, set minDate to minDate: moment().subtract(1,'d') which will be yesterday.






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32431218%2fdatetimepicker-unable-to-select-the-todaydate%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      You are setting the minData to new Data()



      new Data() by default gives the current data.



      So In your case you are not able to select not only today's date but all the past date.



      So simple remove the minData parameter(as below), or use it a different way.



      $('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY"});






      share|improve this answer





















      • In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
        – vamsi kr
        Sep 7 '15 at 5:09












      • stackoverflow.com/questions/5511323/javascript-yesterday
        – sanjeev
        Sep 7 '15 at 5:17










      • @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
        – P_S
        Sep 7 '15 at 12:57


















      1














      You are setting the minData to new Data()



      new Data() by default gives the current data.



      So In your case you are not able to select not only today's date but all the past date.



      So simple remove the minData parameter(as below), or use it a different way.



      $('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY"});






      share|improve this answer





















      • In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
        – vamsi kr
        Sep 7 '15 at 5:09












      • stackoverflow.com/questions/5511323/javascript-yesterday
        – sanjeev
        Sep 7 '15 at 5:17










      • @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
        – P_S
        Sep 7 '15 at 12:57
















      1












      1








      1






      You are setting the minData to new Data()



      new Data() by default gives the current data.



      So In your case you are not able to select not only today's date but all the past date.



      So simple remove the minData parameter(as below), or use it a different way.



      $('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY"});






      share|improve this answer












      You are setting the minData to new Data()



      new Data() by default gives the current data.



      So In your case you are not able to select not only today's date but all the past date.



      So simple remove the minData parameter(as below), or use it a different way.



      $('#datetimepicker1').datetimepicker().data("DateTimePicker").options({format: "DD/MM/YYYY"});







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Sep 7 '15 at 5:04









      sanjeev

      2,83911023




      2,83911023












      • In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
        – vamsi kr
        Sep 7 '15 at 5:09












      • stackoverflow.com/questions/5511323/javascript-yesterday
        – sanjeev
        Sep 7 '15 at 5:17










      • @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
        – P_S
        Sep 7 '15 at 12:57




















      • In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
        – vamsi kr
        Sep 7 '15 at 5:09












      • stackoverflow.com/questions/5511323/javascript-yesterday
        – sanjeev
        Sep 7 '15 at 5:17










      • @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
        – P_S
        Sep 7 '15 at 12:57


















      In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
      – vamsi kr
      Sep 7 '15 at 5:09






      In this case we able to select the previous dates too.So that's y we used the minDate.Is there any solution for this(Not select previous dates) @sanjeev
      – vamsi kr
      Sep 7 '15 at 5:09














      stackoverflow.com/questions/5511323/javascript-yesterday
      – sanjeev
      Sep 7 '15 at 5:17




      stackoverflow.com/questions/5511323/javascript-yesterday
      – sanjeev
      Sep 7 '15 at 5:17












      @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
      – P_S
      Sep 7 '15 at 12:57






      @vamsikr As the Datetimepicker uses Moment, the best way to get yesterday is moment().subtract(1, 'day')
      – P_S
      Sep 7 '15 at 12:57















      1














      You have to integrade use Below code to select the todaydate



      minDate: new Date().setHours(0,0,0,0)



      $("#startdatetimepicker").datetimepicker({ minDate : new
      Date().setHours(0,0,0,0),format: 'DD-MM-YYYY'});





      • It select the today's date also after picked another date and go for select today's date.

      • It's also disable the previous date.






      share|improve this answer




























        1














        You have to integrade use Below code to select the todaydate



        minDate: new Date().setHours(0,0,0,0)



        $("#startdatetimepicker").datetimepicker({ minDate : new
        Date().setHours(0,0,0,0),format: 'DD-MM-YYYY'});





        • It select the today's date also after picked another date and go for select today's date.

        • It's also disable the previous date.






        share|improve this answer


























          1












          1








          1






          You have to integrade use Below code to select the todaydate



          minDate: new Date().setHours(0,0,0,0)



          $("#startdatetimepicker").datetimepicker({ minDate : new
          Date().setHours(0,0,0,0),format: 'DD-MM-YYYY'});





          • It select the today's date also after picked another date and go for select today's date.

          • It's also disable the previous date.






          share|improve this answer














          You have to integrade use Below code to select the todaydate



          minDate: new Date().setHours(0,0,0,0)



          $("#startdatetimepicker").datetimepicker({ minDate : new
          Date().setHours(0,0,0,0),format: 'DD-MM-YYYY'});





          • It select the today's date also after picked another date and go for select today's date.

          • It's also disable the previous date.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '18 at 12:50

























          answered Nov 21 '18 at 9:59









          Aman Singh

          112




          112























              0














              You should use following code.



               <script src="/assets/js/plugins/datetime/bootstrap-datetimepicker.min.js"></script> 
              $('#datetimepicker1').datetimepicker({
              weekStart: 1,
              todayBtn: 1,
              autoclose: 1,
              todayHighlight: 1,
              startView: 2,
              minView: 2,
              forceParse: 0
              });





              share|improve this answer























              • Still unable to select the today date@Singh
                – vamsi kr
                Sep 7 '15 at 5:00
















              0














              You should use following code.



               <script src="/assets/js/plugins/datetime/bootstrap-datetimepicker.min.js"></script> 
              $('#datetimepicker1').datetimepicker({
              weekStart: 1,
              todayBtn: 1,
              autoclose: 1,
              todayHighlight: 1,
              startView: 2,
              minView: 2,
              forceParse: 0
              });





              share|improve this answer























              • Still unable to select the today date@Singh
                – vamsi kr
                Sep 7 '15 at 5:00














              0












              0








              0






              You should use following code.



               <script src="/assets/js/plugins/datetime/bootstrap-datetimepicker.min.js"></script> 
              $('#datetimepicker1').datetimepicker({
              weekStart: 1,
              todayBtn: 1,
              autoclose: 1,
              todayHighlight: 1,
              startView: 2,
              minView: 2,
              forceParse: 0
              });





              share|improve this answer














              You should use following code.



               <script src="/assets/js/plugins/datetime/bootstrap-datetimepicker.min.js"></script> 
              $('#datetimepicker1').datetimepicker({
              weekStart: 1,
              todayBtn: 1,
              autoclose: 1,
              todayHighlight: 1,
              startView: 2,
              minView: 2,
              forceParse: 0
              });






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 7 '15 at 5:32

























              answered Sep 7 '15 at 4:51









              Developer

              1,52611221




              1,52611221












              • Still unable to select the today date@Singh
                – vamsi kr
                Sep 7 '15 at 5:00


















              • Still unable to select the today date@Singh
                – vamsi kr
                Sep 7 '15 at 5:00
















              Still unable to select the today date@Singh
              – vamsi kr
              Sep 7 '15 at 5:00




              Still unable to select the today date@Singh
              – vamsi kr
              Sep 7 '15 at 5:00











              0














              You're setting the minDate to today, which means won't be able to select it.



              Instead, set minDate to minDate: moment().subtract(1,'d') which will be yesterday.






              share|improve this answer


























                0














                You're setting the minDate to today, which means won't be able to select it.



                Instead, set minDate to minDate: moment().subtract(1,'d') which will be yesterday.






                share|improve this answer
























                  0












                  0








                  0






                  You're setting the minDate to today, which means won't be able to select it.



                  Instead, set minDate to minDate: moment().subtract(1,'d') which will be yesterday.






                  share|improve this answer












                  You're setting the minDate to today, which means won't be able to select it.



                  Instead, set minDate to minDate: moment().subtract(1,'d') which will be yesterday.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 7 '15 at 16:48









                  Eonasdan

                  5,71964366




                  5,71964366






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32431218%2fdatetimepicker-unable-to-select-the-todaydate%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      404 Error Contact Form 7 ajax form submitting

                      How to know if a Active Directory user can login interactively

                      TypeError: fit_transform() missing 1 required positional argument: 'X'