Repository: moment/luxon (js)

Issue:
`Duration#toFormat` should support a formatting token for `week`
I'm surprised that `Duration#toFormat` doesn't support a token for `week` (7 days). (e.g. `w`)

Is there a reason this unit token was omitted for Duration specifically?

Current release tag source ref: https://github.com/moment/luxon/blob/2.3.1/src/duration.js#L397-L426

Pull request description:
feat: add week formatting token "w" for duration
Resolves #1164

(Working with casual conversion accuracy was quite confusing when writing the test. 🤯)

Patch:
diff --git a/src/duration.js b/src/duration.js
index 2530a410..0cec4f56 100644
--- a/src/duration.js
+++ b/src/duration.js
@@ -401,6 +401,7 @@ export default class Duration {
    * * `m` for minutes
    * * `h` for hours
    * * `d` for days
+   * * `w` for weeks
    * * `M` for months
    * * `y` for years
    * Notes:
diff --git a/src/impl/formatter.js b/src/impl/formatter.js
index 38200c85..b3486301 100644
--- a/src/impl/formatter.js
+++ b/src/impl/formatter.js
@@ -363,6 +363,8 @@ export default class Formatter {
             return "hour";
           case "d":
             return "day";
+          case "w":
+            return "week";
           case "M":
             return "month";
           case "y":


Test patch:
diff --git a/test/duration/format.test.js b/test/duration/format.test.js
index 686154fe..abcf4f4c 100644
--- a/test/duration/format.test.js
+++ b/test/duration/format.test.js
@@ -206,6 +206,19 @@ test("Duration#toFormat('d') returns days", () => {
   expect(lil.toFormat("dddd")).toBe("0006");
 });
 
+test("Duration#toFormat('w') returns weeks", () => {
+  expect(dur().toFormat("w")).toBe("61");
+  expect(dur().toFormat("w", { floor: false })).toBe("61.453");
+  expect(dur().toFormat("w:s")).toBe("61:273906");
+  expect(dur().toFormat("w:dd:h:mm:ss.SSS")).toBe("61:03:4:05:06.007");
+
+  const lil = Duration.fromObject({ weeks: 6 });
+  expect(lil.toFormat("w")).toBe("6");
+  expect(lil.toFormat("ww")).toBe("06");
+  expect(lil.toFormat("www")).toBe("006");
+  expect(lil.toFormat("wwww")).toBe("0006");
+});
+
 test("Duration#toFormat('M') returns months", () => {
   expect(dur().toFormat("M")).toBe("14");
   expect(dur().toFormat("M", { floor: false })).toBe("14.356");