Jquery 输入掩码 "dd-mm-yyyy hh:mm"

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

如何配置实现"dd-mm-yyyy hh:mm"格式?

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

这不起作用,它显示 "dd-mm-yyyy h:s",我只能编辑 "dd-mm-yyyy"。

inputmask

https://jsfiddle.net/re4qxxr1/

终于得到答案,Link我得到的答案是 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">

试试这个对你有帮助:

$('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/

如果您使用的是 Inputmask 4.*:

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