Skip to content

Commit 86412ca

Browse files
committed
Remove non-numeric characters from version strings
1 parent 4e8ca6a commit 86412ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dash/dash-renderer/src/components/error/menu/VersionInfo.react.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import './VersionInfo.css';
55
const DAY_IN_MS = 86400000;
66

77
function compareVersions(v1, v2) {
8+
// Remove any non-numeric characters from the version strings
9+
// and anything after them (e.g. 1.2.3-rc.1 -> 1.2.3, 1.2.3+build.1 -> 1.2.3)
10+
v1 = v1.replace(/[^0-9.].*$/, '');
11+
v2 = v2.replace(/[^0-9.].*$/, '');
12+
813
const v1Parts = v1.split('.').map(Number);
914
const v2Parts = v2.split('.').map(Number);
1015

0 commit comments

Comments
 (0)