Repository: moment/luxon
Pull request #952 (2021-06-03 23:49:06)

Fixed small typo
Fixed small typo where the closing quotation was missing inside the `fromObject` documentation inside `src/duration`


Patch:
diff --git a/docs/zones.md b/docs/zones.md
index 57305e19..1c3bf2a0 100644
--- a/docs/zones.md
+++ b/docs/zones.md
@@ -228,7 +228,7 @@ Most of the time, DST shifts will happen without you having to do anything about
 
 ### Invalid times
 
-Some local times simply don't exist. The Spring Forward DST shift involves shifting the local time forward by (usually) one hour. In my zone, `America/New_York`, on March 12, 2017 the millisecond after 1:59:59.999 is 3:00:00.000. Thus the times between 2:00:00.000 and 2:59:59.000, inclusive, don't exist in that zone. But of course, nothing stops a user from constructing a DateTime out of that local time.
+Some local times simply don't exist. The Spring Forward DST shift involves shifting the local time forward by (usually) one hour. In my zone, `America/New_York`, on March 12, 2017 the millisecond after 1:59:59.999 is 3:00:00.000. Thus the times between 2:00:00.000 and 2:59:59.999, inclusive, don't exist in that zone. But of course, nothing stops a user from constructing a DateTime out of that local time.
 
 If you create such a DateTime from scratch, the missing time will be advanced by an hour:
 
diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js
index f1b4c80b..bcb64814 100644
--- a/scripts/bootstrap.js
+++ b/scripts/bootstrap.js
@@ -4,3 +4,4 @@ global.Duration = luxon.Duration;
 global.Interval = luxon.Interval;
 global.Settings = luxon.Settings;
 global.Info = luxon.Info;
+global.IANAZone = luxon.IANAZone;
diff --git a/src/duration.js b/src/duration.js
index 14c4e692..4fcfa4bd 100644
--- a/src/duration.js
+++ b/src/duration.js
@@ -216,7 +216,7 @@ export default class Duration {
   }
 
   /**
-   * Create a Duration from a JavaScript object with keys like 'years' and 'hours.
+   * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.
    * If this object is empty then a zero milliseconds duration is returned.
    * @param {Object} obj - the object to create the DateTime from
    * @param {number} obj.years
diff --git a/src/impl/regexParser.js b/src/impl/regexParser.js
index 8e4308b6..0b0297b1 100644
--- a/src/impl/regexParser.js
+++ b/src/impl/regexParser.js
@@ -267,7 +267,11 @@ const extractISOWeekTimeAndOffset = combineExtractors(
   extractISOTime,
   extractISOOffset
 );
-const extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime);
+const extractISOOrdinalDateAndTime = combineExtractors(
+  extractISOOrdinalData,
+  extractISOTime,
+  extractISOOffset
+);
 const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset);
 
 /**
@@ -279,7 +283,7 @@ export function parseISODate(s) {
     s,
     [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
     [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
-    [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime],
+    [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],
     [isoTimeCombinedRegex, extractISOTimeAndOffset]
   );
 }


Test patch:
diff --git a/test/datetime/regexParse.test.js b/test/datetime/regexParse.test.js
index 10f8c159..5d655887 100644
--- a/test/datetime/regexParse.test.js
+++ b/test/datetime/regexParse.test.js
@@ -435,6 +435,20 @@ test("DateTime.fromISO() accepts year-ordinalTtime", () => {
   });
 });
 
+test("DateTime.fromISO() accepts year-ordinalTtime+offset", () => {
+  const dt = DateTime.fromISO("2016-200T09:24:15.123+0600", { setZone: true });
+  expect(dt.zone.name).toBe("UTC+6");
+  expect(dt.toObject()).toEqual({
+    year: 2016,
+    month: 7,
+    day: 18,
+    hour: 9,
+    minute: 24,
+    second: 15,
+    millisecond: 123
+  });
+});
+
 test("DateTime.fromISO() accepts hour:minute:second.millisecond", () => {
   const { year, month, day } = DateTime.now();
   isSame("09:24:15.123", {