question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compare version number with rc is incorrect

See original GitHub issue

Hi,

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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shuyingzcommented, Sep 19, 2019

Interesting thing… I checked the behavior on the npm semver and here is the result…

const semver = require('semver')
semver.compare('1.0.0-rc11', '1.0.0-rc3') // ---- return -1 

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.

0reactions
piotrooocommented, Jul 22, 2022

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found