Merge lp:~cubicerp/openerp-web/fix-bug-1128572-unreconize-translated-month-names into lp:openerp-web/7.0

Proposed by Cubic ERP
Status: Needs review
Proposed branch: lp:~cubicerp/openerp-web/fix-bug-1128572-unreconize-translated-month-names
Merge into: lp:openerp-web/7.0
Diff against target: 24 lines (+12/-1)
1 file modified
addons/web/static/lib/datejs/parser.js (+12/-1)
To merge this branch: bzr merge lp:~cubicerp/openerp-web/fix-bug-1128572-unreconize-translated-month-names
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+180194@code.launchpad.net

Description of the change

Fix to bug 1128572 Unrecognize translated month names in date fields

To post a comment you must log in.

Unmerged revisions

4013. By Cubic ERP

[FIX] datejs/parser.js fixed to support MMM format in foreing languajes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/lib/datejs/parser.js'
2--- addons/web/static/lib/datejs/parser.js 2011-08-22 14:39:24 +0000
3+++ addons/web/static/lib/datejs/parser.js 2013-08-14 17:35:22 +0000
4@@ -1110,7 +1110,18 @@
5 * @param {Object} The expected format {String} or an array of expected formats {Array} of the date string [Required].
6 * @return {Date} A Date object or null if the string cannot be converted into a Date.
7 */
8- $D.parseExact = function (s, fx) {
9+ $D.parseExact = function (s, fx) {
10+ //YT Convert locale month abreviated to english month abreviated
11+ var mmm_index = fx.indexOf('MMM');
12+ if (mmm_index >= 0) {
13+ var mmm_months = "jan feb mar apr may jun jul aug sep oct nov dec".split(' ');
14+ var mmm_abbreviatedMonths = {};
15+ $.map($D.CultureInfo.abbreviatedMonthNames, function(value,i){
16+ mmm_abbreviatedMonths[value] = mmm_months[i]
17+ });
18+ s = s.substr(0,mmm_index) + mmm_abbreviatedMonths[s.substr(mmm_index,3)] + s.substr(mmm_index+3);
19+ };
20+
21 return $D.getParseFunction(fx)(s);
22 };
23 }());
24\ No newline at end of file