Repository: moment/luxon
Pull request #1171 (2022-03-30 12:55:58)

Minor corrections

linux-foundation-easycla[bot]:  <a href="https://api.easycla.lfx.linuxfoundation.org/v2/repository-provider/github/sign/19772872/47118129/1171/#/?version=2"><img src="https://s3.amazonaws.com/cla-project-logo-prod/cla-not-signed.svg" alt="CLA Not Signed" align="left" height="28" width="328"></a><br/><br /><ul><li><a href='https://api.easycla.lfx.linuxfoundation.org/v2/repository-provider/github/sign/19772872/47118129/1171/#/?version=2' target='_blank'>:x:</a> - login: @h-h-h-h . The commit (ea481d0e29c331ad4a71cac5ea5553252afe7d07) is not authorized under a signed CLA. <a href='https://api.easycla.lfx.linuxfoundation.org/v2/repository-provider/github/sign/19772872/47118129/1171/#/?version=2' target='_blank'>Please click here to be authorized</a>. For further assistance with EasyCLA, <a href='https://jira.linuxfoundation.org/servicedesk/customer/portal/4' target='_blank'>please submit a support request ticket</a>.</li></ul>

Patch:
diff --git a/docs/zones.md b/docs/zones.md
index fbcc2f15..589499dc 100644
--- a/docs/zones.md
+++ b/docs/zones.md
@@ -243,7 +243,7 @@ DateTime.local(2017, 3, 13, 2, 30)
 
 ### Ambiguous times
 
-Harder to handle are ambiguous times. During Fall Back, some local times happen twice. In my zone, `America/New_York`, on November 5, 2017 the millisecond after `1:59:59.000` became `1:00:00.000`. But of course there was already a 1:00 that day, one hour before before this one. So if you create a DateTime with a local time of 1:30, which time do you mean? It's an important question, because they correspond to different moments in time.
+Harder to handle are ambiguous times. During Fall Back, some local times happen twice. In my zone, `America/New_York`, on November 5, 2017 the millisecond after `1:59:59.999` became `1:00:00.000`. But of course there was already a 1:00 that day, one hour before this one. So if you create a DateTime with a local time of 1:30, which time do you mean? It's an important question, because they correspond to different moments in time.
 
 However, Luxon's behavior here is undefined. It makes no promises about which of the two possible timestamps the instance will represent. Currently, its specific behavior is like this:
 
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":
diff --git a/src/zones/IANAZone.js b/src/zones/IANAZone.js
index efe7e564..ff1f0567 100644
--- a/src/zones/IANAZone.js
+++ b/src/zones/IANAZone.js
@@ -81,7 +81,7 @@ export default class IANAZone extends Zone {
    * @param {string} s - The string to check validity on
    * @example IANAZone.isValidSpecifier("America/New_York") //=> true
    * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
-   * @deprecated This method returns false some valid IANA names. Use isValidZone instead
+   * @deprecated This method returns false for some valid IANA names. Use isValidZone instead.
    * @return {boolean}
    */
   static isValidSpecifier(s) {


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");