Repository: moment/luxon (js)

Issue:
Adding 0 units (Say milliseconds) makes a duration compare non equal
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.

```typescript

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 ? 

Pull request:
Durations are considered equal with extra zero units. Fixes #809

Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..dca9e456
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,24 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ""
+labels: bug
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Please share a minimal code example that triggers the problem:
+
+**Actual vs Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Desktop (please complete the following information):**
+
+- OS: [e.g. iOS]
+- Browser [e.g. Chrome 84, safari 14.0]
+- Luxon version [e.g. 1.25.0]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..34981977
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,18 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ""
+labels: enhancement
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/src/duration.js b/src/duration.js
index 3c6889a6..f498abd8 100644
--- a/src/duration.js
+++ b/src/duration.js
@@ -762,8 +762,14 @@ export default class Duration {
       return false;
     }
 
+    function eq(v1, v2) {
+      // Consider 0 and undefined as equal
+      if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;
+      return v1 === v2;
+    }
+
     for (const u of orderedUnits) {
-      if (this.values[u] !== other.values[u]) {
+      if (!eq(this.values[u], other.values[u])) {
         return false;
       }
     }


Test patch:
diff --git a/test/duration/equality.test.js b/test/duration/equality.test.js
index 6d22dfca..bfbd50de 100644
--- a/test/duration/equality.test.js
+++ b/test/duration/equality.test.js
@@ -18,6 +18,14 @@ test("equals identically constructed but one has sting type values", () => {
   expect(l1.equals(l2)).toBe(true);
 });
 
+// #809
+test("equals with extra zero units", () => {
+  const l1 = Duration.fromObject({ years: 5, days: 6 }),
+    l2 = Duration.fromObject({ years: 5, days: 6, minutes: 0, seconds: -0 });
+  expect(l1.equals(l2)).toBe(true);
+  expect(l2.equals(l1)).toBe(true);
+});
+
 test("does not equal an invalid duration", () => {
   const l1 = Duration.fromObject({ years: 5, days: 6 }),
     l2 = Duration.invalid("because");