nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: moment/luxon
Pull request #1232 (2022-07-08 13:33:25)

Fix link to duration months


Patch:
diff --git a/src/duration.js b/src/duration.js
index 72c1b197..f86e4ef1 100644
--- a/src/duration.js
+++ b/src/duration.js
@@ -160,7 +160,7 @@ function normalizeValues(matrix, vals) {
  * Here is a brief overview of commonly used methods and getters in Duration:
  *
  * * **Creation** To create a Duration, use {@link Duration#fromMillis}, {@link Duration#fromObject}, or {@link Duration#fromISO}.
- * * **Unit values** See the {@link Duration#years}, {@link Duration.months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.
+ * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.
  * * **Configuration** See  {@link Duration#locale} and {@link Duration#numberingSystem} accessors.
  * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.
  * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}
diff --git a/src/impl/regexParser.js b/src/impl/regexParser.js
index 0c7219aa..43689a45 100644
--- a/src/impl/regexParser.js
+++ b/src/impl/regexParser.js
@@ -234,7 +234,7 @@ function preprocessRFC2822(s) {
 const rfc1123 =
     /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,
   rfc850 =
-    /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,
+    /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,
   ascii =
     /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
 


Test patch:
diff --git a/test/datetime/regexParse.test.js b/test/datetime/regexParse.test.js
index c297c0f9..db8ee530 100644
--- a/test/datetime/regexParse.test.js
+++ b/test/datetime/regexParse.test.js
@@ -814,6 +814,20 @@ test("DateTime.fromHTTP() can parse RFC 850", () => {
   });
 });
 
+test("DateTime.fromHTTP() can parse RFC 850 on Wednesday", () => {
+  const dt = DateTime.fromHTTP("Wednesday, 29-Jun-22 08:49:37 GMT");
+  expect(dt.isValid).toBe(true);
+  expect(dt.toUTC().toObject()).toEqual({
+    year: 2022,
+    month: 6,
+    day: 29,
+    hour: 8,
+    minute: 49,
+    second: 37,
+    millisecond: 0,
+  });
+});
+
 test("DateTime.fromHTTP() can parse ASCII dates with one date digit", () => {
   const dt = DateTime.fromHTTP("Sun Nov  6 08:49:37 1994");
   expect(dt.isValid).toBe(true);
Repository: moment/luxon
Pull request #1336 (2022-11-29 04:20:43)

Fix tests
Alternative version of #1331


Patch:
diff --git a/docs/parsing.md b/docs/parsing.md
index 25da750c..2b2607a1 100644
--- a/docs/parsing.md
+++ b/docs/parsing.md
@@ -127,7 +127,7 @@ Not every token supported by `DateTime#toFormat` is supported in the parser. For
 
 ### Parsing Two Digit Years
 
-In order to parse a year (or ISO week year) using the `yy` (or `kk`) tokens from a two digit string, a cutoff year after which a the year is interpreted as the current century must be used. By default, the cutoff date is 60, ie: the string "60" is parsed as the year 2060, and the string "61" is parsed as the year 1961. The cutoff year can be configured using `Settings.twoDigitCutoffYear`.
+In order to parse a two digit string as a year (or ISO week year), the `yy` (and `kk`) token must use a cutoff year after which the year being parsed is interpreted as referring to the current century. By default, the cutoff year is set to 60, meaning that the string "60" is parsed as the year 2060, and the string "61" is parsed as the year 1961. The cutoff year can be configured using `Settings.twoDigitCutoffYear`.
 
 ### Debugging
 
diff --git a/src/impl/regexParser.js b/src/impl/regexParser.js
index 43689a45..20c9f814 100644
--- a/src/impl/regexParser.js
+++ b/src/impl/regexParser.js
@@ -3,7 +3,6 @@ import {
   signedOffset,
   parseInteger,
   parseMillis,
-  ianaRegex,
   isUndefined,
   parseFloating,
 } from "./util.js";
@@ -21,6 +20,8 @@ import IANAZone from "../zones/IANAZone.js";
  * Some extractions are super dumb and simpleParse and fromStrings help DRY them.
  */
 
+const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
+
 function combineRegexes(...regexes) {
   const full = regexes.reduce((f, r) => f + r.source, "");
   return RegExp(`^${full}$`);
diff --git a/src/impl/util.js b/src/impl/util.js
index 613f9294..c07136f6 100644
--- a/src/impl/util.js
+++ b/src/impl/util.js
@@ -269,6 +269,3 @@ export function formatOffset(offset, format) {
 export function timeObject(obj) {
   return pick(obj, ["hour", "minute", "second", "millisecond"]);
 }
-
-export const ianaRegex =
-  /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;


Test patch:
diff --git a/test/datetime/tokenParse.test.js b/test/datetime/tokenParse.test.js
index 92c93e38..45095c55 100644
--- a/test/datetime/tokenParse.test.js
+++ b/test/datetime/tokenParse.test.js
@@ -1,7 +1,7 @@
 /* global test expect */
 import { DateTime } from "../../src/luxon";
 import Helpers from "../helpers";
-
+import Settings from "../../src/settings";
 import { ConflictingSpecificationError } from "../../src/errors";
 
 //------