2

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/

Sodiaan
  • 341
  • 1
  • 3
  • 10

3 Answers3

7

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/

Abdul Rafay
  • 787
  • 6
  • 21
1

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">
Ganesh Putta
  • 2,622
  • 2
  • 19
  • 26
0

If you are using Inputmask 4.*:

    Inputmask("datetime", {
        inputFormat: "dd-mm-yyyy HH:MM",
        placeholder: "_",
        leapday: "-02-29",
        alias: "tt.mm.jjjj"
    }).mask(".my-fields-to-mask");
Astrophage
  • 1,231
  • 1
  • 12
  • 38