Repository: moment/luxon
Pull request #718 (2020-05-31 15:13:52)

All tests assume America/NewYork timezone
Some tests require the local timezone to be "America/New_York", relying on the DST of this zone, such as :

_DateTime#diff handles fractional days as fractions of those specific days_

while 2 tests are protected by `if (DateTime.local().zoneName === "America/New_York")`

It seems more consistent to assume all tests require this specific timezone, as is done in `test/zones/local.test.js`:

```
expect(LocalZone.instance.name).toBe("America/New_York");
```


Patch:
diff --git a/docs/formatting.md b/docs/formatting.md
index 74d3ba60..414f38ba 100644
--- a/docs/formatting.md
+++ b/docs/formatting.md
@@ -89,6 +89,7 @@ Here's the full set of provided presets using the October 14, 1983 at 13:30:23 a
 | --------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------- | -------------------------------------------------------- |
 | DATE_SHORT                  | short date                                                         | 10/14/1983                                                 | 14/10/1983                                               |
 | DATE_MED                    | abbreviated date                                                   | Oct 14, 1983                                               | 14 oct. 1983                                             |
+| DATE_MED_WITH_WEEKDAY       | abbreviated date with weekday                                      | Fri, Oct 14, 1983                                          | ven. 14 oct. 1983                                        |
 | DATE_FULL                   | full date                                                          | October 14, 1983                                           | 14 octobre 1983                                          |
 | DATE_HUGE                   | full date with weekday                                             | Tuesday, October 14, 1983                                  | vendredi 14 octobre 1983                                 |
 | TIME_SIMPLE                 | time                                                               | 1:30 PM                                                    | 13:30                                                    |
diff --git a/src/datetime.js b/src/datetime.js
index c123b853..27089bf7 100644
--- a/src/datetime.js
+++ b/src/datetime.js
@@ -1943,6 +1943,14 @@ export default class DateTime {
     return Formats.DATE_MED;
   }
 
+  /**
+   * {@link toLocaleString} format like 'Fri, Oct 14, 1983'
+   * @type {Object}
+   */
+  static get DATE_MED_WITH_WEEKDAY() {
+    return Formats.DATE_MED_WITH_WEEKDAY;
+  }
+
   /**
    * {@link toLocaleString} format like 'October 14, 1983'
    * @type {Object}
diff --git a/src/impl/english.js b/src/impl/english.js
index 100d5796..633f5943 100644
--- a/src/impl/english.js
+++ b/src/impl/english.js
@@ -187,6 +187,8 @@ export function formatString(knownFormat) {
       return "M/d/yyyy";
     case stringify(Formats.DATE_MED):
       return "LLL d, yyyy";
+    case stringify(Formats.DATE_MED_WITH_WEEKDAY):
+      return "EEE, LLL d, yyyy";
     case stringify(Formats.DATE_FULL):
       return "LLLL d, yyyy";
     case stringify(Formats.DATE_HUGE):
diff --git a/src/impl/formats.js b/src/impl/formats.js
index 8c66b9a3..25210f6f 100644
--- a/src/impl/formats.js
+++ b/src/impl/formats.js
@@ -18,6 +18,13 @@ export const DATE_MED = {
   day: n
 };
 
+export const DATE_MED_WITH_WEEKDAY = {
+  year: n,
+  month: s,
+  day: n,
+  weekday: s
+};
+
 export const DATE_FULL = {
   year: n,
   month: l,


Test patch:
diff --git a/test/datetime/degrade.test.js b/test/datetime/degrade.test.js
index 9bca381f..b2cdec38 100644
--- a/test/datetime/degrade.test.js
+++ b/test/datetime/degrade.test.js
@@ -29,6 +29,7 @@ Helpers.withoutIntl("DateTime#toLocaleString supports known configurations", ()
 
   expected.set(DateTime.DATE_SHORT, "8/6/2014");
   expected.set(DateTime.DATE_MED, "Aug 6, 2014");
+  expected.set(DateTime.DATE_MED_WITH_WEEKDAY, "Wed, Aug 6, 2014");
   expected.set(DateTime.DATE_FULL, "August 6, 2014");
   expected.set(DateTime.DATE_HUGE, "Wednesday, August 6, 2014");
   expected.set(DateTime.TIME_SIMPLE, "9:15 AM");
diff --git a/test/datetime/diff.test.js b/test/datetime/diff.test.js
index 3fc10b1e..9a68875f 100644
--- a/test/datetime/diff.test.js
+++ b/test/datetime/diff.test.js
@@ -216,12 +216,10 @@ test("DateTime#diff handles fractional days as fractions of those specific days"
 });
 
 test("DateTime#diff is precise for lower order units", () => {
-  if (DateTime.local().zoneName === "America/New_York") {
-    // spring forward skips one hour
-    expect(
-      diffObjs({ year: 2016, month: 5, day: 5 }, { year: 2016, month: 1, day: 1 }, "hours")
-    ).toEqual({ hours: 2999 });
-  }
+  // spring forward skips one hour
+  expect(
+    diffObjs({ year: 2016, month: 5, day: 5 }, { year: 2016, month: 1, day: 1 }, "hours")
+  ).toEqual({ hours: 2999 });
 });
 
 test("DateTime#diff passes through options", () => {
diff --git a/test/datetime/zone.test.js b/test/datetime/zone.test.js
index 4d023253..b5157ddd 100644
--- a/test/datetime/zone.test.js
+++ b/test/datetime/zone.test.js
@@ -250,10 +250,8 @@ test("Etc/GMT zones work even though V8 does not support them", () => {
 //------
 
 test("The local zone does local stuff", () => {
-  if (DateTime.local().zoneName === "America/New_York") {
-    expect(DateTime.local(2016, 8, 6).offsetNameLong).toBe("Eastern Daylight Time");
-    expect(DateTime.local(2016, 8, 6).offsetNameShort).toBe("EDT");
-  }
+  expect(DateTime.local(2016, 8, 6).offsetNameLong).toBe("Eastern Daylight Time");
+  expect(DateTime.local(2016, 8, 6).offsetNameShort).toBe("EDT");
 });
 
 //------