(format, dateObjValue, opts, raw)
| 104 | return result; |
| 105 | } |
| 106 | function parse(format, dateObjValue, opts, raw) { |
| 107 | var mask = "", match; |
| 108 | while (match = getTokenizer(opts).exec(format)) { |
| 109 | if (dateObjValue === undefined) { |
| 110 | if (formatCode[match[0]]) { |
| 111 | mask += "(" + formatCode[match[0]][0] + ")"; |
| 112 | } else { |
| 113 | switch (match[0]) { |
| 114 | case "[": |
| 115 | mask += "("; |
| 116 | break; |
| 117 | |
| 118 | case "]": |
| 119 | mask += ")?"; |
| 120 | break; |
| 121 | |
| 122 | default: |
| 123 | mask += Inputmask.escapeRegex(match[0]); |
| 124 | } |
| 125 | } |
| 126 | } else { |
| 127 | if (formatCode[match[0]]) { |
| 128 | if (raw !== true && formatCode[match[0]][3]) { |
| 129 | var getFn = formatCode[match[0]][3]; |
| 130 | mask += getFn.call(dateObjValue.date); |
| 131 | } else if (formatCode[match[0]][2]) mask += dateObjValue["raw" + formatCode[match[0]][2]]; else mask += match[0]; |
| 132 | } else mask += match[0]; |
| 133 | } |
| 134 | } |
| 135 | return mask; |
| 136 | } |
| 137 | function pad(val, len) { |
| 138 | val = String(val); |
| 139 | len = len || 2; |
no test coverage detected