MCPcopy Create free account
hub / github.com/ampproject/amphtml / getTokenizer

Function getTokenizer

third_party/inputmask/inputmask.date.extensions.js:69–79  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

67 isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
68 };
69 function getTokenizer(opts) {
70 if (!opts.tokenizer) {
71 var tokens = [];
72 for (var ndx in formatCode) {
73 if (tokens.indexOf(ndx[0]) === -1) tokens.push(ndx[0]);
74 }
75 opts.tokenizer = "(" + tokens.join("+|") + ")+?|.";
76 opts.tokenizer = new RegExp(opts.tokenizer, "g");
77 }
78 return opts.tokenizer;
79 }
80 function isValidDate(dateParts, currentResult) {
81 return !isFinite(dateParts.rawday) || dateParts.day == "29" && !isFinite(dateParts.rawyear) || dateParts.year.length < 4 || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day ? currentResult : false;
82 }

Callers 3

parseFunction · 0.85
analyseMaskFunction · 0.85
factoryFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected