summaryrefslogtreecommitdiff
path: root/django/contrib/admin/media/js/dateparse.js
diff options
context:
space:
mode:
authorArthur Koziel <arthur@arthurkoziel.com>2010-09-13 00:04:27 +0000
committerArthur Koziel <arthur@arthurkoziel.com>2010-09-13 00:04:27 +0000
commitdd49269c7db008b2567f50cb03c4d3d9b321daa1 (patch)
tree326dd25bb045ac016cda7966b43cbdfe1f67d699 /django/contrib/admin/media/js/dateparse.js
parentc9b188c4ec939abbe48dae5a371276742e64b6b8 (diff)
downloaddjango-soc2010/app-loading.tar.gz
[soc2010/app-loading] merged trunkarchive/soc2010/app-loadingsoc2010/app-loading
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/app-loading@13818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/admin/media/js/dateparse.js')
-rw-r--r--django/contrib/admin/media/js/dateparse.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/django/contrib/admin/media/js/dateparse.js b/django/contrib/admin/media/js/dateparse.js
index e1c870e146..3cb82dea13 100644
--- a/django/contrib/admin/media/js/dateparse.js
+++ b/django/contrib/admin/media/js/dateparse.js
@@ -100,8 +100,9 @@ var dateParsePatterns = [
{ re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i,
handler: function(bits) {
var d = new Date();
- d.setDate(parseInt(bits[1], 10));
+ d.setDate(1);
d.setMonth(parseMonth(bits[2]));
+ d.setDate(parseInt(bits[1], 10));
return d;
}
},
@@ -109,9 +110,10 @@ var dateParsePatterns = [
{ re: /^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i,
handler: function(bits) {
var d = new Date();
- d.setDate(parseInt(bits[1], 10));
- d.setMonth(parseMonth(bits[2]));
+ d.setDate(1);
d.setYear(bits[3]);
+ d.setMonth(parseMonth(bits[2]));
+ d.setDate(parseInt(bits[1], 10));
return d;
}
},
@@ -119,8 +121,9 @@ var dateParsePatterns = [
{ re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?$/i,
handler: function(bits) {
var d = new Date();
- d.setDate(parseInt(bits[2], 10));
+ d.setDate(1);
d.setMonth(parseMonth(bits[1]));
+ d.setDate(parseInt(bits[2], 10));
return d;
}
},
@@ -128,9 +131,10 @@ var dateParsePatterns = [
{ re: /^(\w+) (\d{1,2})(?:st|nd|rd|th)?,? (\d{4})$/i,
handler: function(bits) {
var d = new Date();
- d.setDate(parseInt(bits[2], 10));
- d.setMonth(parseMonth(bits[1]));
+ d.setDate(1);
d.setYear(bits[3]);
+ d.setMonth(parseMonth(bits[1]));
+ d.setDate(parseInt(bits[2], 10));
return d;
}
},
@@ -158,9 +162,10 @@ var dateParsePatterns = [
{ re: /(\d{1,2})\/(\d{1,2})\/(\d{4})/,
handler: function(bits) {
var d = new Date();
+ d.setDate(1);
d.setYear(bits[3]);
- d.setDate(parseInt(bits[2], 10));
d.setMonth(parseInt(bits[1], 10) - 1); // Because months indexed from 0
+ d.setDate(parseInt(bits[2], 10));
return d;
}
},
@@ -168,6 +173,7 @@ var dateParsePatterns = [
{ re: /(\d{4})-(\d{1,2})-(\d{1,2})/,
handler: function(bits) {
var d = new Date();
+ d.setDate(1);
d.setYear(parseInt(bits[1]));
d.setMonth(parseInt(bits[2], 10) - 1);
d.setDate(parseInt(bits[3], 10));