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

Adding 0 units (Say milliseconds) makes a duration compare non equal #809

Closed
rgammans opened this issue Oct 10, 2020 · 0 comments
Closed

Comments

@rgammans
Copy link

I think this should be a bug, although I accept there might be an argument I haven't considered.

Given this simple testcase I would consider the two values to compare as equal.

import { DateTime, Duration } from 'luxon';

function main() {

    const testoffset= Duration.fromISO("P1W");
    const testzero  = Duration.fromMillis(0);

    const same_offset = testoffset.plus(testzero)

    console.assert(testoffset.equals(same_offset),
                    "Aren't these logically the same");

};

main();

But have I missed something ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant