From fb2168f6a37f474897d5bc69356743b72d9f739d Mon Sep 17 00:00:00 2001
From: Bastian Kleineidam <calvin@debian.org>
Date: Fri, 25 Jan 2008 17:23:27 +0100
Subject: Support European date format for JavaScript
Add support for parsing European date format "DD.MM.YYYY" in
the JavaScript date routines.
Signed-off-by: Bastian Kleineidam <calvin@debian.org>
diff --git a/django/contrib/admin/media/js/core.js b/django/contrib/admin/media/js/core.js
index c8d0db6..a3238d0 100644
a
|
b
|
Date.prototype.getISODate = function() {
|
139 | 139 | return this.getCorrectYear() + '-' + this.getTwoDigitMonth() + '-' + this.getTwoDigitDate(); |
140 | 140 | } |
141 | 141 | |
| 142 | Date.prototype.getEuropeanDate = function() { |
| 143 | return this.getTwoDigitDate() + '.' + this.getTwoDigitMonth() + '.' + this.getCorrectYear(); |
| 144 | } |
| 145 | |
142 | 146 | Date.prototype.getHourMinute = function() { |
143 | 147 | return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute(); |
144 | 148 | } |
diff --git a/django/contrib/admin/media/js/dateparse.js b/django/contrib/admin/media/js/dateparse.js
index e1c870e..dd06880 100644
a
|
b
|
var dateParsePatterns = [
|
174 | 174 | return d; |
175 | 175 | } |
176 | 176 | }, |
| 177 | // dd.mm.yyyy (European style) |
| 178 | { re: /(\d{1,2})\.(\d{1,2}).(\d{4})/, |
| 179 | handler: function(bits) { |
| 180 | var d = new Date(); |
| 181 | d.setDate(parseInt(bits[1], 10)); |
| 182 | d.setMonth(parseInt(bits[2], 10) - 1); |
| 183 | d.setYear(parseInt(bits[3])); |
| 184 | return d; |
| 185 | } |
| 186 | }, |
177 | 187 | ]; |
178 | 188 | |
179 | 189 | function parseDateString(s) { |