Merge lp:~openerp-dev/openerp-web/6.1-opw-579979-msh into lp:openerp-web/6.1

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/6.1-opw-579979-msh
Merge into: lp:openerp-web/6.1
Diff against target: 39 lines (+6/-6)
1 file modified
addons/web/static/lib/datejs/parser.js (+6/-6)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/6.1-opw-579979-msh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+128860@code.launchpad.net

Description of the change

Hello,

Fixed the issue of date/datetime parsing which goes failed when trailing 0 missed in value by parseExact.

If you have specified date/datetime format %dd/%mm/%yy %H:%M:%S and if you does not enter trailing 0 in value like 4/10/12 10:10:00 then it will interchange the month and date, it happens if you missed any trailing 0 in date or in time.

Reason :- Reason is that parse the date/datetime value using parseExact and if we missed trailing 0 then parseExact will fail and parse is called which will parse date/datetime in default format, so month and date is interchanged.

Thanks.

To post a comment you must log in.

Unmerged revisions

2464. By Mohammed Shekha(Open ERP)

[FIX]Fixed the issue of date/datetime not parsed by parseExact if someone missed to enter trailing 0, like format is %dd/%mm/%yy and if he enters date 4/10/12 then parseExact will fail, and on fialing we have called parse method which parse the date/datetime in mm/dd/yy format, so due to this month and date is interchanged.

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 2012-10-10 06:12:19 +0000
4@@ -766,13 +766,13 @@
5
6 // hour, minute, second, meridian, timezone
7 g.h = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));
8- g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/), t.hour));
9+ g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));
10 g.H = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));
11- g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/), t.hour));
12+ g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));
13 g.m = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.minute));
14- g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.minute));
15+ g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]|[0-9]/), t.minute));
16 g.s = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.second));
17- g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.second));
18+ g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]|[0-9]/), t.second));
19 g.hms = _.cache(_.sequence([g.H, g.m, g.s], g.timePartDelimiter));
20
21 // _.min(1, _.set([ g.H, g.m, g.s ], g._t));
22@@ -788,7 +788,7 @@
23 // days, months, years
24 g.d = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),
25 _.optional(g.ctoken2("ordinalSuffix"))), t.day));
26- g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),
27+ g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),
28 _.optional(g.ctoken2("ordinalSuffix"))), t.day));
29 g.ddd = g.dddd = _.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),
30 function (s) {
31@@ -798,7 +798,7 @@
32 }
33 ));
34 g.M = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));
35- g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/), t.month));
36+ g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));
37 g.MMM = g.MMMM = _.cache(_.process(
38 g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"), t.month));
39 g.y = _.cache(_.process(_.rtoken(/^(\d\d?)/), t.year));