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
=== modified file 'addons/web/static/lib/datejs/parser.js'
--- addons/web/static/lib/datejs/parser.js 2011-08-22 14:39:24 +0000
+++ addons/web/static/lib/datejs/parser.js 2012-10-10 06:12:19 +0000
@@ -766,13 +766,13 @@
766766
767 // hour, minute, second, meridian, timezone767 // hour, minute, second, meridian, timezone
768 g.h = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));768 g.h = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));
769 g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/), t.hour));769 g.hh = _.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/), t.hour));
770 g.H = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));770 g.H = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));
771 g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/), t.hour));771 g.HH = _.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/), t.hour));
772 g.m = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.minute));772 g.m = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.minute));
773 g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.minute));773 g.mm = _.cache(_.process(_.rtoken(/^[0-5][0-9]|[0-9]/), t.minute));
774 g.s = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.second));774 g.s = _.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/), t.second));
775 g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]/), t.second));775 g.ss = _.cache(_.process(_.rtoken(/^[0-5][0-9]|[0-9]/), t.second));
776 g.hms = _.cache(_.sequence([g.H, g.m, g.s], g.timePartDelimiter));776 g.hms = _.cache(_.sequence([g.H, g.m, g.s], g.timePartDelimiter));
777 777
778 // _.min(1, _.set([ g.H, g.m, g.s ], g._t));778 // _.min(1, _.set([ g.H, g.m, g.s ], g._t));
@@ -788,7 +788,7 @@
788 // days, months, years788 // days, months, years
789 g.d = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/), 789 g.d = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),
790 _.optional(g.ctoken2("ordinalSuffix"))), t.day));790 _.optional(g.ctoken2("ordinalSuffix"))), t.day));
791 g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/), 791 g.dd = _.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),
792 _.optional(g.ctoken2("ordinalSuffix"))), t.day));792 _.optional(g.ctoken2("ordinalSuffix"))), t.day));
793 g.ddd = g.dddd = _.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"), 793 g.ddd = g.dddd = _.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),
794 function (s) { 794 function (s) {
@@ -798,7 +798,7 @@
798 }798 }
799 ));799 ));
800 g.M = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));800 g.M = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));
801 g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/), t.month));801 g.MM = _.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/), t.month));
802 g.MMM = g.MMMM = _.cache(_.process(802 g.MMM = g.MMMM = _.cache(_.process(
803 g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"), t.month));803 g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"), t.month));
804 g.y = _.cache(_.process(_.rtoken(/^(\d\d?)/), t.year));804 g.y = _.cache(_.process(_.rtoken(/^(\d\d?)/), t.year));