Compare version number with rc is incorrect
See original GitHub issueHi,
Hope you are doing well!
I am wondering if semver supports version with rc without a dot (.) - exp: 1.0.0-rc1
I have two version numbers - 1.0.0-rc3
and 1.0.0-rc11
, and for the current lib, when I am trying to compare these two versions, it shown me that 1.0.0-rc3
> 1.0.0-rc11
but which is not making any sense to me.
Semver sem1 = new Semver("1.0.0-rc3", Semver.SemverType.LOOSE);
Semver sem2 = new Semver("1.0.0-rc11", Semver.SemverType.LOOSE);
System.out.println(sem1.isGreaterThan(sem2)); // --- which is true
Can anybody please help?
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
c# - Compare version numbers without using split function
I've just written an extension method CompareTo with 1 additional argument - number of significant parts of version number to compare (between 1 ......
Read more >Version comparators exclude rc releases · Issue #8854 - GitHub
I believe if we specify >=0.4, then 0.5, 0.5-rc, 0.5-rc.2 etc should all be considered valid. This might be intentional, curious to hear...
Read more >version_compare - Manual - PHP
version_compare — Compares two "PHP-standardized" version number strings ... RC.1'. Then it compares the parts starting from left to right.
Read more >Compare two Version numbers - GeeksforGeeks
In this problem, we are given two version numbers. We need to compare them and conclude which one is the latest version number...
Read more >Semantic Versioning 2.0.0-rc.2
Under this scheme, version numbers and the way they change convey meaning ... A bug fix is defined as an internal change that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Interesting thing… I checked the behavior on the npm semver and here is the result…
Above means rc11 is smaller than rc3. I think the npm also probably using the string comparison, but anyway I created a PR for that. Please let me know what you are thinking.
@shuyingz if you are still interesting, I’ve made copy of this lib and fix bug reported by you. Look for version 2.0.1