Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery UI v1.13 getNumber RegExp not working for dateRange #2264

Open
glanujnehra opened this issue Jun 17, 2024 · 1 comment
Open

jQuery UI v1.13 getNumber RegExp not working for dateRange #2264

glanujnehra opened this issue Jun 17, 2024 · 1 comment

Comments

@glanujnehra
Copy link

Description

Due to the changes introduced in jQuery UI v1.13 for function getNumber selecting dateRange from date clear out to date

getNumber = function( match ) {
      var isDoubled = lookAhead( match ),
      size = ( match === "@" ? 14 : ( match === "!" ? 20 :
      ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
      minSize = ( match === "y" ? size : 1 ),
      digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
      num = value.substring( iValue ).match( digits );
      if ( !num ) {
      throw "Missing number at position " + iValue;
      }
      iValue += num[ 0 ].length;
      return parseInt( num[ 0 ], 10 );
},

RCA

Updating jQuery UI from v1.9.2 to v1.13.2 changes the behaviour of getNumber function which extract a number from the string value.
The issue was also observed when switching to version 1.12.1

Solution

changing
v1.13.2
digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
to v1.9.2
digits = new RegExp('^\\d{1,' + size + '}'),

will fix the issue.

Screenshot

wwwwww Screenshot 2024-06-18 at 1 37 05 AM

Affected Product

Magento -> Admin -> Reports -> Products -> Ordered

Error

Missing number at position 5

Link to test case

@mgol
Copy link
Member

mgol commented Jul 5, 2024

Thanks for the report. Since the issue is already in 1.12, given limited team resources it's not likely to be fixed by the UI team; see the project status at https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/. PRs are welcome if they're not too complex and contain tests.

Please also provide a runnable test case on JS Bin or similar. Just seeing a screenshot from a full app is not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants