inputmask.date.extensions.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /*
  2. Input Mask plugin extensions
  3. http://github.com/RobinHerbots/jquery.inputmask
  4. Copyright (c) 2010 - Robin Herbots
  5. Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
  6. Version: 0.0.0-dev
  7. Optional extensions on the jquery.inputmask base
  8. */
  9. (function($) {
  10. //date & time aliases
  11. Inputmask.extendDefinitions({
  12. "h": { //hours
  13. validator: "[01][0-9]|2[0-3]",
  14. cardinality: 2,
  15. prevalidator: [{
  16. validator: "[0-2]",
  17. cardinality: 1
  18. }]
  19. },
  20. "s": { //seconds || minutes
  21. validator: "[0-5][0-9]",
  22. cardinality: 2,
  23. prevalidator: [{
  24. validator: "[0-5]",
  25. cardinality: 1
  26. }]
  27. },
  28. "d": { //basic day
  29. validator: "0[1-9]|[12][0-9]|3[01]",
  30. cardinality: 2,
  31. prevalidator: [{
  32. validator: "[0-3]",
  33. cardinality: 1
  34. }]
  35. },
  36. "m": { //basic month
  37. validator: "0[1-9]|1[012]",
  38. cardinality: 2,
  39. prevalidator: [{
  40. validator: "[01]",
  41. cardinality: 1
  42. }]
  43. },
  44. "y": { //basic year
  45. validator: "(19|20)\\d{2}",
  46. cardinality: 4,
  47. prevalidator: [{
  48. validator: "[12]",
  49. cardinality: 1
  50. }, {
  51. validator: "(19|20)",
  52. cardinality: 2
  53. }, {
  54. validator: "(19|20)\\d",
  55. cardinality: 3
  56. }]
  57. }
  58. });
  59. Inputmask.extendAliases({
  60. "dd/mm/yyyy": {
  61. mask: "1/2/y",
  62. placeholder: "dd/mm/yyyy",
  63. regex: {
  64. val1pre: new RegExp("[0-3]"), //daypre
  65. val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), //day
  66. val2pre: function(separator) {
  67. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  68. return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
  69. }, //monthpre
  70. val2: function(separator) {
  71. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  72. return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
  73. } //month
  74. },
  75. leapday: "29/02/",
  76. separator: "/",
  77. yearrange: {
  78. minyear: 1900,
  79. maxyear: 2099
  80. },
  81. isInYearRange: function(chrs, minyear, maxyear) {
  82. if (isNaN(chrs)) return false;
  83. var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length)));
  84. var enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
  85. return (!isNaN(enteredyear) ? minyear <= enteredyear && enteredyear <= maxyear : false) ||
  86. (!isNaN(enteredyear2) ? minyear <= enteredyear2 && enteredyear2 <= maxyear : false);
  87. },
  88. determinebaseyear: function(minyear, maxyear, hint) {
  89. var currentyear = (new Date()).getFullYear();
  90. if (minyear > currentyear) return minyear;
  91. if (maxyear < currentyear) {
  92. var maxYearPrefix = maxyear.toString().slice(0, 2);
  93. var maxYearPostfix = maxyear.toString().slice(2, 4);
  94. while (maxyear < maxYearPrefix + hint) {
  95. maxYearPrefix--;
  96. }
  97. var maxxYear = maxYearPrefix + maxYearPostfix;
  98. return minyear > maxxYear ? minyear : maxxYear;
  99. }
  100. return currentyear;
  101. },
  102. onKeyDown: function(e, buffer, caretPos, opts) {
  103. var $input = $(this);
  104. if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
  105. var today = new Date();
  106. $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());
  107. $input.triggerHandler("setvalue.inputmask");
  108. }
  109. },
  110. getFrontValue: function(mask, buffer, opts) {
  111. var start = 0,
  112. length = 0;
  113. for (var i = 0; i < mask.length; i++) {
  114. if (mask.charAt(i) === "2") break;
  115. var definition = opts.definitions[mask.charAt(i)];
  116. if (definition) {
  117. start += length;
  118. length = definition.cardinality;
  119. } else length++;
  120. }
  121. return buffer.join("").substr(start, length);
  122. },
  123. definitions: {
  124. "1": { //val1 ~ day or month
  125. validator: function(chrs, maskset, pos, strict, opts) {
  126. var isValid = opts.regex.val1.test(chrs);
  127. if (!strict && !isValid) {
  128. if (chrs.charAt(1) === opts.separator || "-./".indexOf(chrs.charAt(1)) !== -1) {
  129. isValid = opts.regex.val1.test("0" + chrs.charAt(0));
  130. if (isValid) {
  131. maskset.buffer[pos - 1] = "0";
  132. return {
  133. "refreshFromBuffer": {
  134. start: pos - 1,
  135. end: pos
  136. },
  137. "pos": pos,
  138. "c": chrs.charAt(0)
  139. };
  140. }
  141. }
  142. }
  143. return isValid;
  144. },
  145. cardinality: 2,
  146. prevalidator: [{
  147. validator: function(chrs, maskset, pos, strict, opts) {
  148. var pchrs = chrs;
  149. if (!isNaN(maskset.buffer[pos + 1])) pchrs += maskset.buffer[pos + 1];
  150. var isValid = pchrs.length === 1 ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
  151. if (!strict && !isValid) {
  152. isValid = opts.regex.val1.test(chrs + "0");
  153. if (isValid) {
  154. maskset.buffer[pos] = chrs;
  155. maskset.buffer[++pos] = "0";
  156. return {
  157. "pos": pos,
  158. "c": "0"
  159. };
  160. }
  161. isValid = opts.regex.val1.test("0" + chrs);
  162. if (isValid) {
  163. maskset.buffer[pos] = "0";
  164. pos++;
  165. return {
  166. "pos": pos
  167. };
  168. }
  169. }
  170. return isValid;
  171. },
  172. cardinality: 1
  173. }]
  174. },
  175. "2": { //val2 ~ day or month
  176. validator: function(chrs, maskset, pos, strict, opts) {
  177. var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
  178. if (frontValue.indexOf(opts.placeholder[0]) !== -1) frontValue = "01" + opts.separator;
  179. var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
  180. if (!strict && !isValid) {
  181. if (chrs.charAt(1) === opts.separator || "-./".indexOf(chrs.charAt(1)) !== -1) {
  182. isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
  183. if (isValid) {
  184. maskset.buffer[pos - 1] = "0";
  185. return {
  186. "refreshFromBuffer": {
  187. start: pos - 1,
  188. end: pos
  189. },
  190. "pos": pos,
  191. "c": chrs.charAt(0)
  192. };
  193. }
  194. }
  195. }
  196. //check leap yeap
  197. if ((opts.mask.indexOf("2") === opts.mask.length - 1) && isValid) {
  198. var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
  199. if (dayMonthValue !== opts.leapday) {
  200. return true;
  201. } else {
  202. var year = parseInt(maskset.buffer.join("").substr(0, 4), 10); //detect leap year
  203. if (year % 4 === 0) {
  204. if (year % 100 === 0) {
  205. if (year % 400 === 0) {
  206. return true;
  207. } else {
  208. return false;
  209. }
  210. } else {
  211. return true;
  212. }
  213. } else return false;
  214. }
  215. }
  216. return isValid;
  217. },
  218. cardinality: 2,
  219. prevalidator: [{
  220. validator: function(chrs, maskset, pos, strict, opts) {
  221. if (!isNaN(maskset.buffer[pos + 1])) chrs += maskset.buffer[pos + 1];
  222. var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
  223. if (frontValue.indexOf(opts.placeholder[0]) !== -1) frontValue = "01" + opts.separator;
  224. var isValid = chrs.length === 1 ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
  225. if (!strict && !isValid) {
  226. isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs);
  227. if (isValid) {
  228. maskset.buffer[pos] = "0";
  229. pos++;
  230. return {
  231. "pos": pos
  232. };
  233. }
  234. }
  235. return isValid;
  236. },
  237. cardinality: 1
  238. }]
  239. },
  240. "y": { //year
  241. validator: function(chrs, maskset, pos, strict, opts) {
  242. if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
  243. var dayMonthValue = maskset.buffer.join("").substr(0, 6);
  244. if (dayMonthValue !== opts.leapday) {
  245. return true;
  246. } else {
  247. var year = parseInt(chrs, 10); //detect leap year
  248. if (year % 4 === 0) {
  249. if (year % 100 === 0) {
  250. if (year % 400 === 0) return true;
  251. else return false;
  252. } else return true;
  253. } else return false;
  254. }
  255. } else return false;
  256. },
  257. cardinality: 4,
  258. prevalidator: [{
  259. validator: function(chrs, maskset, pos, strict, opts) {
  260. var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
  261. if (!strict && !isValid) {
  262. var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
  263. isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
  264. if (isValid) {
  265. maskset.buffer[pos++] = yearPrefix.charAt(0);
  266. return {
  267. "pos": pos
  268. };
  269. }
  270. yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2);
  271. isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
  272. if (isValid) {
  273. maskset.buffer[pos++] = yearPrefix.charAt(0);
  274. maskset.buffer[pos++] = yearPrefix.charAt(1);
  275. return {
  276. "pos": pos
  277. };
  278. }
  279. }
  280. return isValid;
  281. },
  282. cardinality: 1
  283. }, {
  284. validator: function(chrs, maskset, pos, strict, opts) {
  285. var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
  286. if (!strict && !isValid) {
  287. var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
  288. isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear);
  289. if (isValid) {
  290. maskset.buffer[pos++] = yearPrefix.charAt(1);
  291. return {
  292. "pos": pos
  293. };
  294. }
  295. yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
  296. if (opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
  297. var dayMonthValue = maskset.buffer.join("").substr(0, 6);
  298. if (dayMonthValue !== opts.leapday) {
  299. isValid = true;
  300. } else {
  301. var year = parseInt(chrs, 10); //detect leap year
  302. if (year % 4 === 0) {
  303. if (year % 100 === 0) {
  304. if (year % 400 === 0) isValid = true;
  305. else isValid = false;
  306. } else isValid = true;
  307. } else isValid = false;
  308. }
  309. } else isValid = false;
  310. if (isValid) {
  311. maskset.buffer[pos - 1] = yearPrefix.charAt(0);
  312. maskset.buffer[pos++] = yearPrefix.charAt(1);
  313. maskset.buffer[pos++] = chrs.charAt(0);
  314. return {
  315. "refreshFromBuffer": {
  316. start: pos - 3,
  317. end: pos
  318. },
  319. "pos": pos
  320. };
  321. }
  322. }
  323. return isValid;
  324. },
  325. cardinality: 2
  326. }, {
  327. validator: function(chrs, maskset, pos, strict, opts) {
  328. return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
  329. },
  330. cardinality: 3
  331. }]
  332. }
  333. },
  334. insertMode: false,
  335. autoUnmask: false
  336. },
  337. "mm/dd/yyyy": {
  338. placeholder: "mm/dd/yyyy",
  339. alias: "dd/mm/yyyy", //reuse functionality of dd/mm/yyyy alias
  340. regex: {
  341. val2pre: function(separator) {
  342. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  343. return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
  344. }, //daypre
  345. val2: function(separator) {
  346. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  347. return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
  348. }, //day
  349. val1pre: new RegExp("[01]"), //monthpre
  350. val1: new RegExp("0[1-9]|1[012]") //month
  351. },
  352. leapday: "02/29/",
  353. onKeyDown: function(e, buffer, caretPos, opts) {
  354. var $input = $(this);
  355. if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
  356. var today = new Date();
  357. $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());
  358. $input.triggerHandler("setvalue.inputmask");
  359. }
  360. }
  361. },
  362. "yyyy/mm/dd": {
  363. mask: "y/1/2",
  364. placeholder: "yyyy/mm/dd",
  365. alias: "mm/dd/yyyy",
  366. leapday: "/02/29",
  367. onKeyDown: function(e, buffer, caretPos, opts) {
  368. var $input = $(this);
  369. if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
  370. var today = new Date();
  371. $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());
  372. $input.triggerHandler("setvalue.inputmask");
  373. }
  374. }
  375. },
  376. "dd.mm.yyyy": {
  377. mask: "1.2.y",
  378. placeholder: "dd.mm.yyyy",
  379. leapday: "29.02.",
  380. separator: ".",
  381. alias: "dd/mm/yyyy"
  382. },
  383. "dd-mm-yyyy": {
  384. mask: "1-2-y",
  385. placeholder: "dd-mm-yyyy",
  386. leapday: "29-02-",
  387. separator: "-",
  388. alias: "dd/mm/yyyy"
  389. },
  390. "mm.dd.yyyy": {
  391. mask: "1.2.y",
  392. placeholder: "mm.dd.yyyy",
  393. leapday: "02.29.",
  394. separator: ".",
  395. alias: "mm/dd/yyyy"
  396. },
  397. "mm-dd-yyyy": {
  398. mask: "1-2-y",
  399. placeholder: "mm-dd-yyyy",
  400. leapday: "02-29-",
  401. separator: "-",
  402. alias: "mm/dd/yyyy"
  403. },
  404. "yyyy.mm.dd": {
  405. mask: "y.1.2",
  406. placeholder: "yyyy.mm.dd",
  407. leapday: ".02.29",
  408. separator: ".",
  409. alias: "yyyy/mm/dd"
  410. },
  411. "yyyy-mm-dd": {
  412. mask: "y-1-2",
  413. placeholder: "yyyy-mm-dd",
  414. leapday: "-02-29",
  415. separator: "-",
  416. alias: "yyyy/mm/dd"
  417. },
  418. "datetime": {
  419. mask: "1/2/y h:s",
  420. placeholder: "dd/mm/yyyy hh:mm",
  421. alias: "dd/mm/yyyy",
  422. regex: {
  423. hrspre: new RegExp("[012]"), //hours pre
  424. hrs24: new RegExp("2[0-4]|1[3-9]"),
  425. hrs: new RegExp("[01][0-9]|2[0-4]"), //hours
  426. ampm: new RegExp("^[a|p|A|P][m|M]"),
  427. mspre: new RegExp("[0-5]"), //minutes/seconds pre
  428. ms: new RegExp("[0-5][0-9]")
  429. },
  430. timeseparator: ":",
  431. hourFormat: "24", // or 12
  432. definitions: {
  433. "h": { //hours
  434. validator: function(chrs, maskset, pos, strict, opts) {
  435. if (opts.hourFormat === "24") {
  436. if (parseInt(chrs, 10) === 24) {
  437. maskset.buffer[pos - 1] = "0";
  438. maskset.buffer[pos] = "0";
  439. return {
  440. "refreshFromBuffer": {
  441. start: pos - 1,
  442. end: pos
  443. },
  444. "c": "0"
  445. };
  446. }
  447. }
  448. var isValid = opts.regex.hrs.test(chrs);
  449. if (!strict && !isValid) {
  450. if (chrs.charAt(1) === opts.timeseparator || "-.:".indexOf(chrs.charAt(1)) !== -1) {
  451. isValid = opts.regex.hrs.test("0" + chrs.charAt(0));
  452. if (isValid) {
  453. maskset.buffer[pos - 1] = "0";
  454. maskset.buffer[pos] = chrs.charAt(0);
  455. pos++;
  456. return {
  457. "refreshFromBuffer": {
  458. start: pos - 2,
  459. end: pos
  460. },
  461. "pos": pos,
  462. "c": opts.timeseparator
  463. };
  464. }
  465. }
  466. }
  467. if (isValid && opts.hourFormat !== "24" && opts.regex.hrs24.test(chrs)) {
  468. var tmp = parseInt(chrs, 10);
  469. if (tmp === 24) {
  470. maskset.buffer[pos + 5] = "a";
  471. maskset.buffer[pos + 6] = "m";
  472. } else {
  473. maskset.buffer[pos + 5] = "p";
  474. maskset.buffer[pos + 6] = "m";
  475. }
  476. tmp = tmp - 12;
  477. if (tmp < 10) {
  478. maskset.buffer[pos] = tmp.toString();
  479. maskset.buffer[pos - 1] = "0";
  480. } else {
  481. maskset.buffer[pos] = tmp.toString().charAt(1);
  482. maskset.buffer[pos - 1] = tmp.toString().charAt(0);
  483. }
  484. return {
  485. "refreshFromBuffer": {
  486. start: pos - 1,
  487. end: pos + 6
  488. },
  489. "c": maskset.buffer[pos]
  490. };
  491. }
  492. return isValid;
  493. },
  494. cardinality: 2,
  495. prevalidator: [{
  496. validator: function(chrs, maskset, pos, strict, opts) {
  497. var isValid = opts.regex.hrspre.test(chrs);
  498. if (!strict && !isValid) {
  499. isValid = opts.regex.hrs.test("0" + chrs);
  500. if (isValid) {
  501. maskset.buffer[pos] = "0";
  502. pos++;
  503. return {
  504. "pos": pos
  505. };
  506. }
  507. }
  508. return isValid;
  509. },
  510. cardinality: 1
  511. }]
  512. },
  513. "s": { //seconds || minutes
  514. validator: "[0-5][0-9]",
  515. cardinality: 2,
  516. prevalidator: [{
  517. validator: function(chrs, maskset, pos, strict, opts) {
  518. var isValid = opts.regex.mspre.test(chrs);
  519. if (!strict && !isValid) {
  520. isValid = opts.regex.ms.test("0" + chrs);
  521. if (isValid) {
  522. maskset.buffer[pos] = "0";
  523. pos++;
  524. return {
  525. "pos": pos
  526. };
  527. }
  528. }
  529. return isValid;
  530. },
  531. cardinality: 1
  532. }]
  533. },
  534. "t": { //am/pm
  535. validator: function(chrs, maskset, pos, strict, opts) {
  536. return opts.regex.ampm.test(chrs + "m");
  537. },
  538. casing: "lower",
  539. cardinality: 1
  540. }
  541. },
  542. insertMode: false,
  543. autoUnmask: false
  544. },
  545. "datetime12": {
  546. mask: "1/2/y h:s t\\m",
  547. placeholder: "dd/mm/yyyy hh:mm xm",
  548. alias: "datetime",
  549. hourFormat: "12"
  550. },
  551. "hh:mm t": {
  552. mask: "h:s t\\m",
  553. placeholder: "hh:mm xm",
  554. alias: "datetime",
  555. hourFormat: "12"
  556. },
  557. "h:s t": {
  558. mask: "h:s t\\m",
  559. placeholder: "hh:mm xm",
  560. alias: "datetime",
  561. hourFormat: "12"
  562. },
  563. "hh:mm:ss": {
  564. mask: "h:s:s",
  565. placeholder: "hh:mm:ss",
  566. alias: "datetime",
  567. autoUnmask: false
  568. },
  569. "hh:mm": {
  570. mask: "h:s",
  571. placeholder: "hh:mm",
  572. alias: "datetime",
  573. autoUnmask: false
  574. },
  575. "date": {
  576. alias: "dd/mm/yyyy" // "mm/dd/yyyy"
  577. },
  578. "mm/yyyy": {
  579. mask: "1/y",
  580. placeholder: "mm/yyyy",
  581. leapday: "donotuse",
  582. separator: "/",
  583. alias: "mm/dd/yyyy"
  584. },
  585. "shamsi": {
  586. regex: {
  587. val2pre: function(separator) {
  588. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  589. return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])");
  590. },
  591. val2: function(separator) {
  592. var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
  593. return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)");
  594. },
  595. val1pre: new RegExp("[01]"),
  596. val1: new RegExp("0[1-9]|1[012]")
  597. },
  598. yearrange: {
  599. minyear: 1300,
  600. maxyear: 1499
  601. },
  602. mask: "y/1/2",
  603. leapday: "/12/30",
  604. placeholder: "yyyy/mm/dd",
  605. alias: "mm/dd/yyyy",
  606. clearIncomplete: true
  607. }
  608. });
  609. return Inputmask;
  610. })(jQuery);