Ticket #2975: dateparse.js.diff
File dateparse.js.diff, 2.4 KB (added by , 18 years ago) |
---|
-
dateparse.js
100 100 { re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i, 101 101 handler: function(bits) { 102 102 var d = new Date(); 103 d.setDate(1); 104 d.setMonth(parseMonth(bits[2])); 103 105 d.setDate(parseInt(bits[1], 10)); 104 d.setMonth(parseMonth(bits[2]));105 106 return d; 106 107 } 107 108 }, … … 109 110 { re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i, 110 111 handler: function(bits) { 111 112 var d = new Date(); 113 d.setDate(1); 114 d.setYear(bits[3]); 115 d.setMonth(parseMonth(bits[2])); 112 116 d.setDate(parseInt(bits[1], 10)); 113 d.setMonth(parseMonth(bits[2]));114 d.setYear(bits[3]);115 117 return d; 116 118 } 117 119 }, … … 119 121 { re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?$/i, 120 122 handler: function(bits) { 121 123 var d = new Date(); 124 d.setDate(1); 125 d.setMonth(parseMonth(bits[1])); 122 126 d.setDate(parseInt(bits[2], 10)); 123 d.setMonth(parseMonth(bits[1]));124 127 return d; 125 128 } 126 129 }, … … 128 131 { re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?,? (\d{4})$/i, 129 132 handler: function(bits) { 130 133 var d = new Date(); 134 d.setDate(1); 135 d.setYear(bits[3]); 136 d.setMonth(parseMonth(bits[1])); 131 137 d.setDate(parseInt(bits[2], 10)); 132 d.setMonth(parseMonth(bits[1]));133 d.setYear(bits[3]);134 138 return d; 135 139 } 136 140 }, … … 158 162 { re: /(\d{1,2})\/(\d{1,2})\/(\d{4})/, 159 163 handler: function(bits) { 160 164 var d = new Date(); 165 d.setDate(1); 161 166 d.setYear(bits[3]); 167 d.setMonth(parseInt(bits[1], 10) - 1); // Because months indexed from 0 162 168 d.setDate(parseInt(bits[2], 10)); 163 d.setMonth(parseInt(bits[1], 10) - 1); // Because months indexed from 0164 169 return d; 165 170 } 166 171 }, … … 168 173 { re: /(\d{4})-(\d{1,2})-(\d{1,2})/, 169 174 handler: function(bits) { 170 175 var d = new Date(); 176 d.setDate(1); 171 177 d.setYear(parseInt(bits[1])); 172 178 d.setMonth(parseInt(bits[2], 10) - 1); 173 179 d.setDate(parseInt(bits[3], 10));