Jquery inputmask "dd-mm-yyyy hh:mm"

15,439

Solution 1

try this will help you:

$('input').inputmask("datetime",{
     mask: "1-2-y h:s", 
     placeholder: "dd-mm-yyyy hh:mm", 
     leapday: "-02-29", 
     separator: "-", 
     alias: "dd-mm-yyyy"
});

Fiddle: https://jsfiddle.net/53nomjyb/193/

Solution 2

Finally Got the answer, Link i got the answer is https://github.com/RobinHerbots/Inputmask/issues/727

(function($){ 
  $('input').inputmask("datetime",{
    mask: "1-2-y h:s", 
    placeholder: "dd-mm-yyyy hh:mm", 
    leapday: "-02-29", 
    separator: "-", 
    alias: "dd/mm/yyyy"
  });
  
})(jQuery)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>
<input type="text">
Share:
15,439
Sodiaan
Author by

Sodiaan

Updated on June 25, 2022

Comments

  • Sodiaan
    Sodiaan almost 2 years

    How to configure to achieve "dd-mm-yyyy hh:mm" format?

    $('input').inputmask({
                    mask: "1-2-y h:s",
                    placeholder: "dd-mm-yyyy hh:mm",
                    leapday: "29-02-",
                    separator: "-",
                    alias: "dd-mm-yyyy"
                });
    

    This not work, it shows "dd-mm-yyyy h:s" and I can edit only "dd-mm-yyyy".

    inputmask

    https://jsfiddle.net/re4qxxr1/

    • Ganesh Putta
      Ganesh Putta over 6 years
      Add some code to fiddle with plugin
    • Pedram
      Pedram over 6 years
      @MasterYoda inputmask is the plugin name.
    • Kaarthik
      Kaarthik over 6 years
      placeholder: "dd-mm-yyyy hh:mm xm" try replacing it with this
    • Sodiaan
      Sodiaan over 6 years
      @GeekBoy it's not working
    • Ganesh Putta
      Ganesh Putta over 6 years
      Check my answer, I found somewhere on the web
  • Sodiaan
    Sodiaan over 6 years
    BTW, why "-02-29" ? Maybe "29-02-" ?