@parischap/conversions 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -49
- package/cjs/BigDecimal.js +2 -2
- package/cjs/BigInt.js +7 -5
- package/cjs/BigInt.js.map +1 -1
- package/cjs/DateTime.js +144 -136
- package/cjs/DateTime.js.map +1 -1
- package/cjs/DateTimeFormat.js +7 -2
- package/cjs/DateTimeFormat.js.map +1 -1
- package/cjs/DateTimeFormatContext.js +11 -6
- package/cjs/DateTimeFormatContext.js.map +1 -1
- package/cjs/Email.js +11 -15
- package/cjs/Email.js.map +1 -1
- package/cjs/Integer.js +33 -23
- package/cjs/Integer.js.map +1 -1
- package/cjs/NumberBase10Format.js +65 -65
- package/cjs/PositiveInteger.js +44 -29
- package/cjs/PositiveInteger.js.map +1 -1
- package/cjs/PositiveReal.js +34 -24
- package/cjs/PositiveReal.js.map +1 -1
- package/cjs/Real.js +29 -18
- package/cjs/Real.js.map +1 -1
- package/cjs/RoundingMode.js +7 -4
- package/cjs/RoundingMode.js.map +1 -1
- package/cjs/RoundingOption.js +6 -6
- package/cjs/RoundingOption.js.map +1 -1
- package/cjs/Schema.js +29 -28
- package/cjs/Schema.js.map +1 -1
- package/cjs/SemVer.js +19 -20
- package/cjs/SemVer.js.map +1 -1
- package/cjs/Template.js +36 -31
- package/cjs/Template.js.map +1 -1
- package/cjs/TemplatePart.js +4 -4
- package/cjs/TemplateParts.js +3 -2
- package/cjs/TemplateParts.js.map +1 -1
- package/cjs/TemplatePlaceholder.js +56 -45
- package/cjs/TemplatePlaceholder.js.map +1 -1
- package/cjs/TemplateSeparator.js +17 -24
- package/cjs/TemplateSeparator.js.map +1 -1
- package/cjs/internal/Int.js +5 -8
- package/cjs/internal/Int.js.map +1 -1
- package/cjs/internal/Positive.js +5 -8
- package/cjs/internal/Positive.js.map +1 -1
- package/dts/BigDecimal.d.ts +2 -2
- package/dts/BigDecimal.d.ts.map +1 -1
- package/dts/BigInt.d.ts +7 -5
- package/dts/BigInt.d.ts.map +1 -1
- package/dts/DateTime.d.ts +145 -137
- package/dts/DateTime.d.ts.map +1 -1
- package/dts/DateTimeFormat.d.ts +7 -2
- package/dts/DateTimeFormat.d.ts.map +1 -1
- package/dts/DateTimeFormatContext.d.ts +17 -12
- package/dts/DateTimeFormatContext.d.ts.map +1 -1
- package/dts/Email.d.ts +16 -13
- package/dts/Email.d.ts.map +1 -1
- package/dts/Integer.d.ts +43 -21
- package/dts/Integer.d.ts.map +1 -1
- package/dts/NumberBase10Format.d.ts +68 -68
- package/dts/PositiveInteger.d.ts +54 -27
- package/dts/PositiveInteger.d.ts.map +1 -1
- package/dts/PositiveReal.d.ts +44 -22
- package/dts/PositiveReal.d.ts.map +1 -1
- package/dts/Real.d.ts +39 -16
- package/dts/Real.d.ts.map +1 -1
- package/dts/RoundingMode.d.ts +6 -3
- package/dts/RoundingMode.d.ts.map +1 -1
- package/dts/RoundingOption.d.ts +6 -6
- package/dts/Schema.d.ts +32 -33
- package/dts/Schema.d.ts.map +1 -1
- package/dts/SemVer.d.ts +25 -13
- package/dts/SemVer.d.ts.map +1 -1
- package/dts/Template.d.ts +30 -29
- package/dts/Template.d.ts.map +1 -1
- package/dts/TemplatePart.d.ts +4 -4
- package/dts/TemplateParts.d.ts +4 -3
- package/dts/TemplateParts.d.ts.map +1 -1
- package/dts/TemplatePlaceholder.d.ts +56 -44
- package/dts/TemplatePlaceholder.d.ts.map +1 -1
- package/dts/TemplateSeparator.d.ts +9 -51
- package/dts/TemplateSeparator.d.ts.map +1 -1
- package/dts/internal/Int.d.ts +0 -4
- package/dts/internal/Int.d.ts.map +1 -1
- package/dts/internal/Positive.d.ts +0 -4
- package/dts/internal/Positive.d.ts.map +1 -1
- package/esm/BigDecimal.js +2 -2
- package/esm/BigInt.js +7 -5
- package/esm/BigInt.js.map +1 -1
- package/esm/DateTime.js +144 -136
- package/esm/DateTime.js.map +1 -1
- package/esm/DateTimeFormat.js +7 -2
- package/esm/DateTimeFormat.js.map +1 -1
- package/esm/DateTimeFormatContext.js +11 -6
- package/esm/DateTimeFormatContext.js.map +1 -1
- package/esm/Email.js +10 -13
- package/esm/Email.js.map +1 -1
- package/esm/Integer.js +33 -23
- package/esm/Integer.js.map +1 -1
- package/esm/NumberBase10Format.js +65 -65
- package/esm/PositiveInteger.js +44 -29
- package/esm/PositiveInteger.js.map +1 -1
- package/esm/PositiveReal.js +34 -24
- package/esm/PositiveReal.js.map +1 -1
- package/esm/Real.js +29 -18
- package/esm/Real.js.map +1 -1
- package/esm/RoundingMode.js +6 -3
- package/esm/RoundingMode.js.map +1 -1
- package/esm/RoundingOption.js +6 -6
- package/esm/RoundingOption.js.map +1 -1
- package/esm/Schema.js +33 -34
- package/esm/Schema.js.map +1 -1
- package/esm/SemVer.js +18 -18
- package/esm/SemVer.js.map +1 -1
- package/esm/Template.js +36 -31
- package/esm/Template.js.map +1 -1
- package/esm/TemplatePart.js +4 -4
- package/esm/TemplateParts.js +3 -2
- package/esm/TemplateParts.js.map +1 -1
- package/esm/TemplatePlaceholder.js +55 -44
- package/esm/TemplatePlaceholder.js.map +1 -1
- package/esm/TemplateSeparator.js +16 -24
- package/esm/TemplateSeparator.js.map +1 -1
- package/esm/internal/Int.js +5 -7
- package/esm/internal/Int.js.map +1 -1
- package/esm/internal/Positive.js +5 -7
- package/esm/internal/Positive.js.map +1 -1
- package/package.json +2 -2
package/cjs/DateTime.js
CHANGED
@@ -32,23 +32,24 @@ function _interopRequireWildcard(e, t) {
|
|
32
32
|
})(e, t);
|
33
33
|
}
|
34
34
|
/**
|
35
|
-
* This module implements an immutable
|
35
|
+
* This module implements an immutable `CVDateTime` object.
|
36
36
|
*
|
37
|
-
*
|
38
|
-
*
|
37
|
+
* `CVDateTime` objects keep an internal state. But all provided functions are pure insofar as they
|
38
|
+
* always yield the same result whatever the state the object is in. The state is only used to
|
39
39
|
* improve performance but does not alter the results.
|
40
40
|
*
|
41
|
-
* Unlike the Javascript Date objects and the Effect DateTime objects,
|
42
|
-
* the Gregorian and Iso calendars. So you can easily get/set the iso year and iso week
|
43
|
-
*
|
41
|
+
* Unlike the Javascript `Date` objects and the Effect `DateTime` objects, `CVDateTime` objects
|
42
|
+
* handle both the Gregorian and Iso calendars. So you can easily get/set the iso year and iso week
|
43
|
+
* of a `CVDateTime` object.
|
44
44
|
*
|
45
|
-
* A
|
46
|
-
* local zone and UTC time (e.g zoneOffset=1 for timezone +1:00). All the data in a
|
47
|
-
* is `zoneOffset-dependent`, except `timestamp`. An important thing to note is that a
|
48
|
-
* object with a timestamp t and a zoneOffset zo has exactly the same date parts
|
49
|
-
* month
|
50
|
-
* That's the reason for the _zonedTimestamp field
|
51
|
-
* performed UTC using _zonedTimestamp instead
|
45
|
+
* A `CVDateTime` object has a `zoneOffset` which is the difference in hours between the time in the
|
46
|
+
* local zone and UTC time (e.g `zoneOffset=1` for timezone +1:00). All the data in a `CVDateTime`
|
47
|
+
* object is `zoneOffset-dependent`, except `timestamp`. An important thing to note is that a
|
48
|
+
* `CVDateTime` object with a timestamp `t` and a zoneOffset `zo` has exactly the same date parts
|
49
|
+
* (`year`, `ordinalDay`, `month`, `monthDay`, `isoYear`...) as a `CVDateTime` object with
|
50
|
+
* `timestamp = t+zox3600` and `zoneOffset = 0`. That's the reason for the _zonedTimestamp field
|
51
|
+
* which is equal to `t+zox3600`. All calculations are performed UTC using _zonedTimestamp instead
|
52
|
+
* of timestamp.
|
52
53
|
*/
|
53
54
|
|
54
55
|
/**
|
@@ -386,7 +387,7 @@ var GregorianDate;
|
|
386
387
|
/**
|
387
388
|
* Returns the `yearIsLeap` property of `self`
|
388
389
|
*
|
389
|
-
* @category
|
390
|
+
* @category Predicates
|
390
391
|
*/
|
391
392
|
GregorianDate.yearIsLeap = /*#__PURE__*/_effect.Struct.get('yearIsLeap');
|
392
393
|
/**
|
@@ -738,7 +739,7 @@ var IsoDate;
|
|
738
739
|
/**
|
739
740
|
* Returns the `yearIsLong` property of `self`
|
740
741
|
*
|
741
|
-
* @category
|
742
|
+
* @category Predicates
|
742
743
|
*/
|
743
744
|
IsoDate.yearIsLong = /*#__PURE__*/_effect.Struct.get('yearIsLong');
|
744
745
|
/**
|
@@ -1237,9 +1238,9 @@ const _uncalculatedFromZonedTimestamp = (zonedTimestamp, zoneOffset) => _make({
|
|
1237
1238
|
/** Instance of an uncalculated DateTime that represents 1/1/1970 00:00:00:000+0:00 */
|
1238
1239
|
const _uncalculatedOrigin = /*#__PURE__*/_uncalculatedFromTimestamp(0, 0);
|
1239
1240
|
/**
|
1240
|
-
* Tries to build a
|
1241
|
+
* Tries to build a `CVDateTime` from `timestamp`, the number of milliseconds since 1/1/1970
|
1241
1242
|
* 00:00:00:000+0:00, and `zoneOffset` which gives the offset between the local time and the UTC
|
1242
|
-
* time. Returns a `
|
1243
|
+
* time. Returns a `Right` if successful, a `Left` otherwise.
|
1243
1244
|
*
|
1244
1245
|
* `timestamp` must be greater than or equal to MIN_TIMESTAMP and less than or equal to
|
1245
1246
|
* MAX_TIMESTAMP.
|
@@ -1267,21 +1268,21 @@ const _uncalculatedOrigin = /*#__PURE__*/_uncalculatedFromTimestamp(0, 0);
|
|
1267
1268
|
*/
|
1268
1269
|
const fromTimestamp = (timestamp, zoneOffset) => (0, _effect.pipe)(_uncalculatedOrigin, _setTimestamp(timestamp), _effect.Either.flatMap(setZoneOffsetKeepTimestamp(zoneOffset)));
|
1269
1270
|
/**
|
1270
|
-
* Same as fromTimestamp but returns directly
|
1271
|
+
* Same as `fromTimestamp` but returns directly a `CVDateTime` or throws if it cannot be built
|
1271
1272
|
*
|
1272
1273
|
* @category Constructors
|
1273
1274
|
*/
|
1274
1275
|
exports.fromTimestamp = fromTimestamp;
|
1275
1276
|
const fromTimestampOrThrow = exports.fromTimestampOrThrow = /*#__PURE__*/(0, _effect.flow)(fromTimestamp, /*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity));
|
1276
1277
|
/**
|
1277
|
-
* Builds a
|
1278
|
+
* Builds a `CVDateTime` using Date.now() as `timestamp`. `zoneOffset` is set to 0.
|
1278
1279
|
*
|
1279
1280
|
* @category Constructors
|
1280
1281
|
*/
|
1281
1282
|
const now = () => _uncalculatedFromTimestamp(Date.now(), 0);
|
1282
1283
|
/**
|
1283
|
-
* Tries to build a
|
1284
|
-
*
|
1284
|
+
* Tries to build a `CVDateTime` from the provided parts. Returns a `Right` if successful, a `Left`
|
1285
|
+
* otherwise.
|
1285
1286
|
*
|
1286
1287
|
* `year` must comprised in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. `ordinalDay` must be greater
|
1287
1288
|
* than or equal to 1 and less than or equal to the number of days in the current year. `month` must
|
@@ -1476,34 +1477,34 @@ const fromParts = ({
|
|
1476
1477
|
return withWeekday;
|
1477
1478
|
});
|
1478
1479
|
/**
|
1479
|
-
* Same as fromParts but returns directly
|
1480
|
+
* Same as `fromParts` but returns directly a `CVDateTime` or throws if it cannot be built
|
1480
1481
|
*
|
1481
1482
|
* @category Constructors
|
1482
1483
|
*/
|
1483
1484
|
exports.fromParts = fromParts;
|
1484
1485
|
const fromPartsOrThrow = exports.fromPartsOrThrow = /*#__PURE__*/(0, _effect.flow)(fromParts, /*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity));
|
1485
1486
|
/**
|
1486
|
-
* Builds a CVDateTime from a Javascript Date
|
1487
|
+
* Builds a `CVDateTime` from a Javascript `Date`
|
1487
1488
|
*
|
1488
1489
|
* @category Constructors
|
1489
1490
|
*/
|
1490
1491
|
const fromDate = date => fromTimestampOrThrow(date.getTime());
|
1491
1492
|
/**
|
1492
|
-
* Builds a CVDateTime from an Effect
|
1493
|
+
* Builds a `CVDateTime` from an `Effect.DateTime.Zoned`
|
1493
1494
|
*
|
1494
1495
|
* @category Constructors
|
1495
1496
|
*/
|
1496
1497
|
exports.fromDate = fromDate;
|
1497
1498
|
const fromEffectDateTime = date => fromTimestampOrThrow(_effect.DateTime.toEpochMillis(date), _effect.DateTime.zonedOffset(date));
|
1498
1499
|
/**
|
1499
|
-
* Builds a Javascript Date from a CVDateTime
|
1500
|
+
* Builds a Javascript `Date` from a `CVDateTime`
|
1500
1501
|
*
|
1501
1502
|
* @category Conversions
|
1502
1503
|
*/
|
1503
1504
|
exports.fromEffectDateTime = fromEffectDateTime;
|
1504
1505
|
const toDate = self => new Date(timestamp(self));
|
1505
1506
|
/**
|
1506
|
-
* Builds an Effect
|
1507
|
+
* Builds an `Effect.DateTime.Zoned` from a `CVDateTime`
|
1507
1508
|
*
|
1508
1509
|
* @category Conversions
|
1509
1510
|
*/
|
@@ -1518,7 +1519,7 @@ const toEffectDateTime = self => _effect.DateTime.unsafeMakeZoned(timestamp(self
|
|
1518
1519
|
*/
|
1519
1520
|
exports.toEffectDateTime = toEffectDateTime;
|
1520
1521
|
const timestamp = exports.timestamp = /*#__PURE__*/_effect.Struct.get('timestamp');
|
1521
|
-
/** Returns the gregorianDate of `self` for the given time zone */
|
1522
|
+
/** Returns the `gregorianDate` of `self` for the given time zone */
|
1522
1523
|
const _gregorianDate = self => (0, _effect.pipe)(self.gregorianDate, _effect.Option.getOrElse(() => {
|
1523
1524
|
const result = GregorianDate.fromTimestamp(self._zonedTimestamp);
|
1524
1525
|
/* eslint-disable-next-line functional/immutable-data, functional/no-expression-statements */
|
@@ -1531,13 +1532,6 @@ const _gregorianDate = self => (0, _effect.pipe)(self.gregorianDate, _effect.Opt
|
|
1531
1532
|
* @category Getters
|
1532
1533
|
*/
|
1533
1534
|
const getYear = exports.getYear = /*#__PURE__*/(0, _effect.flow)(_gregorianDate, GregorianDate.year);
|
1534
|
-
/**
|
1535
|
-
* Returns true if the (Gregorian) year of `self` for the given time zone is a leap year. Returns
|
1536
|
-
* false otherwise
|
1537
|
-
*
|
1538
|
-
* @category Getters
|
1539
|
-
*/
|
1540
|
-
const yearIsLeap = exports.yearIsLeap = /*#__PURE__*/(0, _effect.flow)(_gregorianDate, GregorianDate.yearIsLeap);
|
1541
1535
|
/**
|
1542
1536
|
* Returns the ordinalDay of `self` for the given time zone
|
1543
1537
|
*
|
@@ -1569,13 +1563,6 @@ const _isoDate = self => (0, _effect.pipe)(self.isoDate, _effect.Option.getOrEls
|
|
1569
1563
|
* @category Getters
|
1570
1564
|
*/
|
1571
1565
|
const getIsoYear = exports.getIsoYear = /*#__PURE__*/(0, _effect.flow)(_isoDate, IsoDate.year);
|
1572
|
-
/**
|
1573
|
-
* Returns true if the isoYear of `self` for the given time zone is a long year. Returns false
|
1574
|
-
* otherwise
|
1575
|
-
*
|
1576
|
-
* @category Getters
|
1577
|
-
*/
|
1578
|
-
const isoYearIsLong = exports.isoYearIsLong = /*#__PURE__*/(0, _effect.flow)(_isoDate, IsoDate.yearIsLong);
|
1579
1566
|
/**
|
1580
1567
|
* Returns the isoWeek of `self` for the given time zone
|
1581
1568
|
*
|
@@ -1692,56 +1679,56 @@ const _timeSetter = self => {
|
|
1692
1679
|
};
|
1693
1680
|
};
|
1694
1681
|
/**
|
1695
|
-
* If possible, returns a
|
1696
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1697
|
-
*
|
1682
|
+
* If possible, returns a `Right` of a `CVDateTime` having year `year` and the same `month`,
|
1683
|
+
* `monthDay`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1684
|
+
* `Left` otherwise. `year` must be an integer comprised in the range [MIN_FULL_YEAR,
|
1698
1685
|
* MAX_FULL_YEAR].
|
1699
1686
|
*
|
1700
1687
|
* @category Setters
|
1701
1688
|
*/
|
1702
1689
|
const setYear = year => self => (0, _effect.pipe)(self, _gregorianDate, GregorianDate.setYear(year), _effect.Either.map(_gregorianDateSetter(self)));
|
1703
1690
|
/**
|
1704
|
-
* Same as setYear but returns directly a
|
1691
|
+
* Same as `setYear` but returns directly a `CVDateTime` or throws in case of an error
|
1705
1692
|
*
|
1706
1693
|
* @category Setters
|
1707
1694
|
*/
|
1708
1695
|
exports.setYear = setYear;
|
1709
1696
|
const setYearOrThrow = exports.setYearOrThrow = /*#__PURE__*/(0, _effect.flow)(setYear, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1710
1697
|
/**
|
1711
|
-
* If possible, returns a
|
1712
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1713
|
-
* error otherwise. `ordinalDay` must be an integer greater than or equal to 1 and less than
|
1714
|
-
* equal to the number of days in the current year
|
1698
|
+
* If possible, returns a `Right` of a `CVDateTime` having ordinalDay `ordinalDay` and the same
|
1699
|
+
* `year`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
1700
|
+
* of an error otherwise. `ordinalDay` must be an integer greater than or equal to 1 and less than
|
1701
|
+
* or equal to the number of days in the current year
|
1715
1702
|
*
|
1716
1703
|
* @category Setters
|
1717
1704
|
*/
|
1718
1705
|
const setOrdinalDay = ordinalDay => self => (0, _effect.pipe)(self, _gregorianDate, GregorianDate.setOrdinalDay(ordinalDay), _effect.Either.map(_gregorianDateSetter(self)));
|
1719
1706
|
/**
|
1720
|
-
* Same as setOrdinalDay but returns directly a
|
1707
|
+
* Same as `setOrdinalDay` but returns directly a `CVDateTime` or throws in case of an error
|
1721
1708
|
*
|
1722
1709
|
* @category Setters
|
1723
1710
|
*/
|
1724
1711
|
exports.setOrdinalDay = setOrdinalDay;
|
1725
1712
|
const setOrdinalDayOrThrow = exports.setOrdinalDayOrThrow = /*#__PURE__*/(0, _effect.flow)(setOrdinalDay, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1726
1713
|
/**
|
1727
|
-
* If possible, returns a
|
1728
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1729
|
-
* error otherwise. `month` must be an integer greater than or equal to 1 (January) and
|
1730
|
-
* equal to 12 (December)
|
1714
|
+
* If possible, returns a `Right` of a `CVDateTime` having month `month` and the same `year`,
|
1715
|
+
* `monthDay`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1716
|
+
* `Left` of an error otherwise. `month` must be an integer greater than or equal to 1 (January) and
|
1717
|
+
* less than or equal to 12 (December)
|
1731
1718
|
*
|
1732
1719
|
* @category Setters
|
1733
1720
|
*/
|
1734
1721
|
const setMonth = month => self => (0, _effect.pipe)(self, _gregorianDate, GregorianDate.setMonth(month), _effect.Either.map(_gregorianDateSetter(self)));
|
1735
1722
|
/**
|
1736
|
-
* Same as setMonth but returns directly a
|
1723
|
+
* Same as `setMonth` but returns directly a `CVDateTime` or throws in case of an error
|
1737
1724
|
*
|
1738
1725
|
* @category Setters
|
1739
1726
|
*/
|
1740
1727
|
exports.setMonth = setMonth;
|
1741
1728
|
const setMonthOrThrow = exports.setMonthOrThrow = /*#__PURE__*/(0, _effect.flow)(setMonth, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1742
1729
|
/**
|
1743
|
-
* If possible, returns a
|
1744
|
-
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1730
|
+
* If possible, returns a `Right` of a `CVDateTime` having monthDay `monthDay` and the same `year`,
|
1731
|
+
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
1745
1732
|
* of an error otherwise. `monthDay` must be an integer greater than or equal to 1 and less than or
|
1746
1733
|
* equal to the number of days in the current month.
|
1747
1734
|
*
|
@@ -1749,63 +1736,63 @@ const setMonthOrThrow = exports.setMonthOrThrow = /*#__PURE__*/(0, _effect.flow)
|
|
1749
1736
|
*/
|
1750
1737
|
const setMonthDay = monthDay => self => (0, _effect.pipe)(self, _gregorianDate, GregorianDate.setMonthDay(monthDay), _effect.Either.map(_gregorianDateSetter(self)));
|
1751
1738
|
/**
|
1752
|
-
* Same as setMonthDay but returns directly a
|
1739
|
+
* Same as `setMonthDay` but returns directly a `CVDateTime` or throws in case of an error
|
1753
1740
|
*
|
1754
1741
|
* @category Setters
|
1755
1742
|
*/
|
1756
1743
|
exports.setMonthDay = setMonthDay;
|
1757
1744
|
const setMonthDayOrThrow = exports.setMonthDayOrThrow = /*#__PURE__*/(0, _effect.flow)(setMonthDay, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1758
1745
|
/**
|
1759
|
-
* If possible, returns a
|
1746
|
+
* If possible, returns a `Right` of a `CVDateTime` having isoYear `isoYear` and the same `isoWeek`,
|
1760
1747
|
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1761
|
-
* `
|
1748
|
+
* `Left` of an error otherwise. `isoYear` must be an integer comprised in the range [MIN_FULL_YEAR,
|
1762
1749
|
* MAX_FULL_YEAR].
|
1763
1750
|
*
|
1764
1751
|
* @category Setters
|
1765
1752
|
*/
|
1766
1753
|
const setIsoYear = isoYear => self => (0, _effect.pipe)(self, _isoDate, IsoDate.setYear(isoYear), _effect.Either.map(_isoDateSetter(self)));
|
1767
1754
|
/**
|
1768
|
-
* Same as setIsoYear but returns directly a
|
1755
|
+
* Same as `setIsoYear` but returns directly a `CVDateTime` or throws in case of an error
|
1769
1756
|
*
|
1770
1757
|
* @category Setters
|
1771
1758
|
*/
|
1772
1759
|
exports.setIsoYear = setIsoYear;
|
1773
1760
|
const setIsoYearOrThrow = exports.setIsoYearOrThrow = /*#__PURE__*/(0, _effect.flow)(setIsoYear, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1774
1761
|
/**
|
1775
|
-
* If possible, returns a
|
1762
|
+
* If possible, returns a Right of a `CVDateTime` having isoWeek `isoWeek` and the same `isoYear`,
|
1776
1763
|
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1777
|
-
* `
|
1764
|
+
* `Left` of an error otherwise. `isoWeek` must be an integer greater than or equal to 1 and less
|
1778
1765
|
* than or equal to the number of iso weeks in the current year.
|
1779
1766
|
*
|
1780
1767
|
* @category Setters
|
1781
1768
|
*/
|
1782
1769
|
const setIsoWeek = isoWeek => self => (0, _effect.pipe)(self, _isoDate, IsoDate.setIsoWeek(isoWeek), _effect.Either.map(_isoDateSetter(self)));
|
1783
1770
|
/**
|
1784
|
-
* Same as setIsoWeek but returns directly a
|
1771
|
+
* Same as `setIsoWeek` but returns directly a `CVDateTime` or throws in case of an error
|
1785
1772
|
*
|
1786
1773
|
* @category Setters
|
1787
1774
|
*/
|
1788
1775
|
exports.setIsoWeek = setIsoWeek;
|
1789
1776
|
const setIsoWeekOrThrow = exports.setIsoWeekOrThrow = /*#__PURE__*/(0, _effect.flow)(setIsoWeek, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1790
1777
|
/**
|
1791
|
-
* If possible, returns a
|
1778
|
+
* If possible, returns a `Right` of a `CVDateTime` having weekday `weekday` and the same `isoYear`,
|
1792
1779
|
* `isoWeek`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1793
|
-
* `
|
1780
|
+
* `Left` of an error otherwise. `weekday` must be an integer greater than or equal to 1 (monday)
|
1794
1781
|
* and less than or equal to 7 (sunday).
|
1795
1782
|
*
|
1796
1783
|
* @category Setters
|
1797
1784
|
*/
|
1798
1785
|
const setWeekday = weekday => self => (0, _effect.pipe)(self, _isoDate, IsoDate.setWeekday(weekday), _effect.Either.map(_isoDateSetter(self)));
|
1799
1786
|
/**
|
1800
|
-
* Same as setWeekday but returns directly a
|
1787
|
+
* Same as `setWeekday` but returns directly a `CVDateTime` or throws in case of an error
|
1801
1788
|
*
|
1802
1789
|
* @category Setters
|
1803
1790
|
*/
|
1804
1791
|
exports.setWeekday = setWeekday;
|
1805
1792
|
const setWeekdayOrThrow = exports.setWeekdayOrThrow = /*#__PURE__*/(0, _effect.flow)(setWeekday, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1806
1793
|
/**
|
1807
|
-
* If possible, returns a
|
1808
|
-
* `ordinalDay`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1794
|
+
* If possible, returns a `Right` of a `CVDateTime` having hour23 `hour23` and the same `year`,
|
1795
|
+
* `ordinalDay`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1809
1796
|
* an error otherwise. `hour23` must be an integer greater than or equal to 0 and less than or equal
|
1810
1797
|
* to 23
|
1811
1798
|
*
|
@@ -1813,38 +1800,38 @@ const setWeekdayOrThrow = exports.setWeekdayOrThrow = /*#__PURE__*/(0, _effect.f
|
|
1813
1800
|
*/
|
1814
1801
|
const setHour23 = hour23 => self => (0, _effect.pipe)(self, _time, Time.setHour23(hour23), _effect.Either.map(_timeSetter(self)));
|
1815
1802
|
/**
|
1816
|
-
* Same as setHour23 but returns directly a
|
1803
|
+
* Same as `setHour23` but returns directly a `CVDateTime` or throws in case of an error
|
1817
1804
|
*
|
1818
1805
|
* @category Setters
|
1819
1806
|
*/
|
1820
1807
|
exports.setHour23 = setHour23;
|
1821
1808
|
const setHour23OrThrow = exports.setHour23OrThrow = /*#__PURE__*/(0, _effect.flow)(setHour23, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1822
1809
|
/**
|
1823
|
-
* If possible, returns a
|
1810
|
+
* If possible, returns a Right of a `CVDateTime` having hour11 `hour11` and the same `year`,
|
1824
1811
|
* `ordinalDay`, `meridiem`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1825
|
-
* `
|
1812
|
+
* `Left` of an error otherwise. `hour11` must be an integer greater than or equal to 0 and less
|
1826
1813
|
* than or equal to 11.
|
1827
1814
|
*
|
1828
1815
|
* @category Setters
|
1829
1816
|
*/
|
1830
1817
|
const setHour11 = hour11 => self => (0, _effect.pipe)(self, _time, Time.setHour11(hour11), _effect.Either.map(_timeSetter(self)));
|
1831
1818
|
/**
|
1832
|
-
* Same as setHour11 but returns directly a
|
1819
|
+
* Same as `setHour11` but returns directly a `CVDateTime` or throws in case of an error
|
1833
1820
|
*
|
1834
1821
|
* @category Setters
|
1835
1822
|
*/
|
1836
1823
|
exports.setHour11 = setHour11;
|
1837
1824
|
const setHour11OrThrow = exports.setHour11OrThrow = /*#__PURE__*/(0, _effect.flow)(setHour11, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1838
1825
|
/**
|
1839
|
-
* Returns a
|
1826
|
+
* Returns a `CVDateTime` having meridiem `meridiem` and the same `year`, `ordinalDay`, `hour11`,
|
1840
1827
|
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`
|
1841
1828
|
*
|
1842
1829
|
* @category Setters
|
1843
1830
|
*/
|
1844
1831
|
const setMeridiem = meridiem => self => (0, _effect.pipe)(self, _time, Time.setMeridiem(meridiem), _timeSetter(self));
|
1845
1832
|
/**
|
1846
|
-
* If possible, returns a
|
1847
|
-
* `ordinalDay`, `hour23`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1833
|
+
* If possible, returns a `Right` of a `CVDateTime` having minute `minute` and the same `year`,
|
1834
|
+
* `ordinalDay`, `hour23`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1848
1835
|
* an error otherwise. `minute` must be an integer greater than or equal to 0 and less than or equal
|
1849
1836
|
* to 59
|
1850
1837
|
*
|
@@ -1853,15 +1840,15 @@ const setMeridiem = meridiem => self => (0, _effect.pipe)(self, _time, Time.setM
|
|
1853
1840
|
exports.setMeridiem = setMeridiem;
|
1854
1841
|
const setMinute = minute => self => (0, _effect.pipe)(self, _time, Time.setMinute(minute), _effect.Either.map(_timeSetter(self)));
|
1855
1842
|
/**
|
1856
|
-
* Same as setMinute but returns directly a
|
1843
|
+
* Same as `setMinute` but returns directly a `CVDateTime` or throws in case of an error
|
1857
1844
|
*
|
1858
1845
|
* @category Setters
|
1859
1846
|
*/
|
1860
1847
|
exports.setMinute = setMinute;
|
1861
1848
|
const setMinuteOrThrow = exports.setMinuteOrThrow = /*#__PURE__*/(0, _effect.flow)(setMinute, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1862
1849
|
/**
|
1863
|
-
* If possible, returns a
|
1864
|
-
* `ordinalDay`, `hour23`, `minute`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1850
|
+
* If possible, returns a Right of a `CVDateTime` having second `second` and the same `year`,
|
1851
|
+
* `ordinalDay`, `hour23`, `minute`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1865
1852
|
* an error otherwise. `second` must be an integer greater than or equal to 0 and less than or equal
|
1866
1853
|
* to 59
|
1867
1854
|
*
|
@@ -1869,31 +1856,31 @@ const setMinuteOrThrow = exports.setMinuteOrThrow = /*#__PURE__*/(0, _effect.flo
|
|
1869
1856
|
*/
|
1870
1857
|
const setSecond = second => self => (0, _effect.pipe)(self, _time, Time.setSecond(second), _effect.Either.map(_timeSetter(self)));
|
1871
1858
|
/**
|
1872
|
-
* Same as setSecond but returns directly a
|
1859
|
+
* Same as `setSecond` but returns directly a `CVDateTime` or throws in case of an error
|
1873
1860
|
*
|
1874
1861
|
* @category Setters
|
1875
1862
|
*/
|
1876
1863
|
exports.setSecond = setSecond;
|
1877
1864
|
const setSecondOrThrow = exports.setSecondOrThrow = /*#__PURE__*/(0, _effect.flow)(setSecond, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1878
1865
|
/**
|
1879
|
-
* If possible, returns a
|
1880
|
-
* `ordinalDay`, `hour23`, `minute`, `second` and `zoneOffset` as `self`. Returns a `
|
1881
|
-
* error otherwise. `millisecond` must be an integer greater than or equal to 0 and less than
|
1882
|
-
* equal to 999.
|
1866
|
+
* If possible, returns a `Right` of a `CVDateTime` having millisecond `millisecond` and the same
|
1867
|
+
* `year`, `ordinalDay`, `hour23`, `minute`, `second` and `zoneOffset` as `self`. Returns a `Left`
|
1868
|
+
* of an error otherwise. `millisecond` must be an integer greater than or equal to 0 and less than
|
1869
|
+
* or equal to 999.
|
1883
1870
|
*
|
1884
1871
|
* @category Setters
|
1885
1872
|
*/
|
1886
1873
|
const setMillisecond = millisecond => self => (0, _effect.pipe)(self, _time, Time.setMillisecond(millisecond), _effect.Either.map(_timeSetter(self)));
|
1887
1874
|
/**
|
1888
|
-
* Same as setMillisecond but returns directly a
|
1875
|
+
* Same as `setMillisecond` but returns directly a `CVDateTime` or throws in case of an error
|
1889
1876
|
*
|
1890
1877
|
* @category Setters
|
1891
1878
|
*/
|
1892
1879
|
exports.setMillisecond = setMillisecond;
|
1893
1880
|
const setMillisecondOrThrow = exports.setMillisecondOrThrow = /*#__PURE__*/(0, _effect.flow)(setMillisecond, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1894
1881
|
/**
|
1895
|
-
* If possible, returns a
|
1896
|
-
* `
|
1882
|
+
* If possible, returns a `Right` of a copy of `self` with timestamp set to `timestamp`. Returns a
|
1883
|
+
* `Left` of an error otherwise. `timestamp` must be an integer comprised in the range
|
1897
1884
|
* [MIN_TIMESTAMP, MAX_TIMESTAMP] representing the number of milliseconds since 1/1/1970
|
1898
1885
|
* 00:00:00:000+0:00.
|
1899
1886
|
*/
|
@@ -1928,8 +1915,8 @@ const _setZoneOffset = (keepTimestamp, zoneOffset = LOCAL_TIME_ZONE_OFFSET) => s
|
|
1928
1915
|
return result;
|
1929
1916
|
});
|
1930
1917
|
/**
|
1931
|
-
* If possible, returns a
|
1932
|
-
* `zoneOffset`.
|
1918
|
+
* If possible, returns a `Right` of a copy of `self` with the same `timestamp` and zoneOffset set
|
1919
|
+
* to `zoneOffset`.
|
1933
1920
|
*
|
1934
1921
|
* If `zoneOffset` is omitted, the local time zone offset of the machine this code is running on is
|
1935
1922
|
* used.
|
@@ -1950,64 +1937,80 @@ const _setZoneOffset = (keepTimestamp, zoneOffset = LOCAL_TIME_ZONE_OFFSET) => s
|
|
1950
1937
|
*/
|
1951
1938
|
const setZoneOffsetKeepTimestamp = zoneOffset => _setZoneOffset(true, zoneOffset);
|
1952
1939
|
/**
|
1953
|
-
* Same as setZoneOffsetKeepTimestamp but returns directly a
|
1940
|
+
* Same as `setZoneOffsetKeepTimestamp` but returns directly a `CVDateTime` or throws in case of an
|
1941
|
+
* error
|
1954
1942
|
*
|
1955
1943
|
* @category Setters
|
1956
1944
|
*/
|
1957
1945
|
exports.setZoneOffsetKeepTimestamp = setZoneOffsetKeepTimestamp;
|
1958
1946
|
const setZoneOffsetKeepTimestampOrThrow = exports.setZoneOffsetKeepTimestampOrThrow = /*#__PURE__*/(0, _effect.flow)(setZoneOffsetKeepTimestamp, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1959
1947
|
/**
|
1960
|
-
* If possible, returns a
|
1961
|
-
* zoneOffset
|
1948
|
+
* If possible, returns a `Right` of a copy of `self` with the same parts (except `zoneOffset`) and
|
1949
|
+
* zoneOffset set to `zoneOffset`.
|
1962
1950
|
*
|
1963
|
-
* See setZoneOffsetKeepTimestamp for more details
|
1951
|
+
* See `setZoneOffsetKeepTimestamp` for more details
|
1964
1952
|
*
|
1965
1953
|
* @category Setters
|
1966
1954
|
*/
|
1967
1955
|
const setZoneOffsetKeepParts = zoneOffset => _setZoneOffset(false, zoneOffset);
|
1968
1956
|
/**
|
1969
|
-
* Same as setZoneOffsetKeepTimestamp but returns directly a
|
1957
|
+
* Same as `setZoneOffsetKeepTimestamp` but returns directly a `CVDateTime` or throws in case of an
|
1958
|
+
* error
|
1970
1959
|
*
|
1971
1960
|
* @category Setters
|
1972
1961
|
*/
|
1973
1962
|
exports.setZoneOffsetKeepParts = setZoneOffsetKeepParts;
|
1974
1963
|
const setZoneOffsetKeepPartsOrThrow = exports.setZoneOffsetKeepPartsOrThrow = /*#__PURE__*/(0, _effect.flow)(setZoneOffsetKeepParts, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
1975
1964
|
/**
|
1976
|
-
* Returns true if self
|
1965
|
+
* Returns true if the (Gregorian) year of `self` for the given time zone is a leap year. Returns
|
1966
|
+
* false otherwise
|
1967
|
+
*
|
1968
|
+
* @category Predicates
|
1969
|
+
*/
|
1970
|
+
const yearIsLeap = exports.yearIsLeap = /*#__PURE__*/(0, _effect.flow)(_gregorianDate, GregorianDate.yearIsLeap);
|
1971
|
+
/**
|
1972
|
+
* Returns true if the isoYear of `self` for the given time zone is a long year. Returns false
|
1973
|
+
* otherwise
|
1974
|
+
*
|
1975
|
+
* @category Predicates
|
1976
|
+
*/
|
1977
|
+
const isoYearIsLong = exports.isoYearIsLong = /*#__PURE__*/(0, _effect.flow)(_isoDate, IsoDate.yearIsLong);
|
1978
|
+
/**
|
1979
|
+
* Returns true if `self` is the first day of a month in the given timezone
|
1977
1980
|
*
|
1978
1981
|
* @category Predicates
|
1979
1982
|
*/
|
1980
1983
|
const isFirstMonthDay = self => getMonthDay(self) === 1;
|
1981
1984
|
/**
|
1982
|
-
* Returns true if self is the last day of a month in the given timezone
|
1985
|
+
* Returns true if `self` is the last day of a month in the given timezone
|
1983
1986
|
*
|
1984
1987
|
* @category Predicates
|
1985
1988
|
*/
|
1986
1989
|
exports.isFirstMonthDay = isFirstMonthDay;
|
1987
1990
|
const isLastMonthDay = self => getMonthDay(self) === (0, _effect.pipe)(self, _gregorianDate, GregorianDate.getNumberOfDaysInMonth(getMonth(self)));
|
1988
1991
|
/**
|
1989
|
-
* Returns true if self is the first day of a year in the given timezone
|
1992
|
+
* Returns true if `self` is the first day of a year in the given timezone
|
1990
1993
|
*
|
1991
1994
|
* @category Predicates
|
1992
1995
|
*/
|
1993
1996
|
exports.isLastMonthDay = isLastMonthDay;
|
1994
1997
|
const isFirstYearDay = self => getOrdinalDay(self) === 1;
|
1995
1998
|
/**
|
1996
|
-
* Returns true if self is the last day of a year in the given timezone
|
1999
|
+
* Returns true if `self` is the last day of a year in the given timezone
|
1997
2000
|
*
|
1998
2001
|
* @category Predicates
|
1999
2002
|
*/
|
2000
2003
|
exports.isFirstYearDay = isFirstYearDay;
|
2001
2004
|
const isLastYearDay = self => getOrdinalDay(self) === (0, _effect.pipe)(self, _gregorianDate, GregorianDate.getYearDurationInDays);
|
2002
2005
|
/**
|
2003
|
-
* Returns true if self is the first day of an iso year in the given timezone
|
2006
|
+
* Returns true if `self` is the first day of an iso year in the given timezone
|
2004
2007
|
*
|
2005
2008
|
* @category Predicates
|
2006
2009
|
*/
|
2007
2010
|
exports.isLastYearDay = isLastYearDay;
|
2008
2011
|
const isFirstIsoYearDay = self => getIsoWeek(self) === 1 && getWeekday(self) === 1;
|
2009
2012
|
/**
|
2010
|
-
* Returns true if self is the last day of an iso year in the given timezone
|
2013
|
+
* Returns true if `self` is the last day of an iso year in the given timezone
|
2011
2014
|
*
|
2012
2015
|
* @category Predicates
|
2013
2016
|
*/
|
@@ -2070,29 +2073,29 @@ const toLastIsoYearWeek = self => (0, _effect.pipe)(self, setIsoWeekOrThrow((0,
|
|
2070
2073
|
exports.toLastIsoYearWeek = toLastIsoYearWeek;
|
2071
2074
|
const toLastIsoYearDay = self => (0, _effect.pipe)(self, toLastIsoYearWeek, setWeekdayOrThrow(7));
|
2072
2075
|
/**
|
2073
|
-
* If possible, returns a copy of `self` offset by `offset` years and having the same
|
2074
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2075
|
-
* true and `self` is on the last day of a month, the
|
2076
|
-
* last of the target month. Otherwise, it will be the
|
2077
|
-
*
|
2076
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` years and having the same
|
2077
|
+
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
2078
|
+
* of an error otherwise. If `respectMonthEnd` is true and `self` is on the last day of a month, the
|
2079
|
+
* new DateTime object's monthDay will be the last of the target month. Otherwise, it will be the
|
2080
|
+
* same as `self`
|
2078
2081
|
*
|
2079
2082
|
* @category Offsetters
|
2080
2083
|
*/
|
2081
2084
|
exports.toLastIsoYearDay = toLastIsoYearDay;
|
2082
2085
|
const offsetYears = (offset, respectMonthEnd) => offsetMonths(offset * 12, respectMonthEnd);
|
2083
2086
|
/**
|
2084
|
-
* Same as offsetYears but returns directly a
|
2087
|
+
* Same as `offsetYears` but returns directly a `CVDateTime` or throws in case of an error
|
2085
2088
|
*
|
2086
|
-
* @category
|
2089
|
+
* @category Offsetters
|
2087
2090
|
*/
|
2088
2091
|
exports.offsetYears = offsetYears;
|
2089
2092
|
const offsetYearsOrThrow = exports.offsetYearsOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetYears, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2090
2093
|
/**
|
2091
|
-
* If possible, returns a copy of `self` offset by `offset` months and having the same
|
2092
|
-
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2093
|
-
* `self` is on the last day of a month, the new
|
2094
|
-
*
|
2095
|
-
*
|
2094
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` months and having the same
|
2095
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of an
|
2096
|
+
* error otherwise. If `respectMonthEnd` is true and `self` is on the last day of a month, the new
|
2097
|
+
* DateTime object's monthDay will be the last of the target month. Otherwise, it will be the same
|
2098
|
+
* as `self`'s
|
2096
2099
|
*
|
2097
2100
|
* @category Offsetters
|
2098
2101
|
*/
|
@@ -2105,31 +2108,32 @@ const offsetMonths = (offset, respectMonthEnd) => self => {
|
|
2105
2108
|
})));
|
2106
2109
|
};
|
2107
2110
|
/**
|
2108
|
-
* Same as offsetMonths but returns directly a
|
2111
|
+
* Same as `offsetMonths` but returns directly a `CVDateTime` or throws in case of an error
|
2109
2112
|
*
|
2110
|
-
* @category
|
2113
|
+
* @category Offsetters
|
2111
2114
|
*/
|
2112
2115
|
exports.offsetMonths = offsetMonths;
|
2113
2116
|
const offsetMonthsOrThrow = exports.offsetMonthsOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetMonths, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2114
2117
|
/**
|
2115
|
-
*
|
2118
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` days. Returns a `Left` of
|
2119
|
+
* an error otherwise.
|
2116
2120
|
*
|
2117
2121
|
* @category Offsetters
|
2118
2122
|
*/
|
2119
2123
|
const offsetDays = offset => offsetMilliseconds(offset * DAY_MS);
|
2120
2124
|
/**
|
2121
|
-
* Same as offsetDays but returns directly a
|
2125
|
+
* Same as `offsetDays` but returns directly a `CVDateTime` or throws in case of an error
|
2122
2126
|
*
|
2123
|
-
* @category
|
2127
|
+
* @category Offsetters
|
2124
2128
|
*/
|
2125
2129
|
exports.offsetDays = offsetDays;
|
2126
2130
|
const offsetDaysOrThrow = exports.offsetDaysOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetDays, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2127
2131
|
/**
|
2128
|
-
* If possible, returns a copy of `self` offset by `offset` iso years and having the
|
2129
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2130
|
-
* true and `self` is on the last day of an iso
|
2131
|
-
*
|
2132
|
-
*
|
2132
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` iso years and having the
|
2133
|
+
* same `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
2134
|
+
* `Left` of an error otherwise. If `respectYearEnd` is true and `self` is on the last day of an iso
|
2135
|
+
* year, the new DateTime object's isoWeek will be the last of the target iso year. Otherwise, it
|
2136
|
+
* will be the same as `self`'s.
|
2133
2137
|
*
|
2134
2138
|
* @category Offsetters
|
2135
2139
|
*/
|
@@ -2141,61 +2145,65 @@ const offsetIsoYears = (offset, respectYearEnd) => self => {
|
|
2141
2145
|
})));
|
2142
2146
|
};
|
2143
2147
|
/**
|
2144
|
-
* Same as offsetIsoYears but returns directly a
|
2148
|
+
* Same as `offsetIsoYears` but returns directly a `CVDateTime` or throws in case of an error
|
2145
2149
|
*
|
2146
|
-
* @category
|
2150
|
+
* @category Offsetters
|
2147
2151
|
*/
|
2148
2152
|
exports.offsetIsoYears = offsetIsoYears;
|
2149
2153
|
const offsetIsoYearsOrThrow = exports.offsetIsoYearsOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetIsoYears, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2150
2154
|
/**
|
2151
|
-
*
|
2155
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` hours. Returns a `Left` of
|
2156
|
+
* an error otherwise.
|
2152
2157
|
*
|
2153
2158
|
* @category Offsetters
|
2154
2159
|
*/
|
2155
2160
|
const offsetHours = offset => offsetMilliseconds(offset * HOUR_MS);
|
2156
2161
|
/**
|
2157
|
-
* Same as offsetHours but returns directly a
|
2162
|
+
* Same as `offsetHours` but returns directly a `CVDateTime` or throws in case of an error
|
2158
2163
|
*
|
2159
|
-
* @category
|
2164
|
+
* @category Offsetters
|
2160
2165
|
*/
|
2161
2166
|
exports.offsetHours = offsetHours;
|
2162
2167
|
const offsetHoursOrThrow = exports.offsetHoursOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetHours, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2163
2168
|
/**
|
2164
|
-
*
|
2169
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` minutes. Returns a `Left`
|
2170
|
+
* of an error otherwise.
|
2165
2171
|
*
|
2166
2172
|
* @category Offsetters
|
2167
2173
|
*/
|
2168
2174
|
const offsetMinutes = offset => offsetMilliseconds(offset * MINUTE_MS);
|
2169
2175
|
/**
|
2170
|
-
* Same as offsetMinutes but returns directly a
|
2176
|
+
* Same as `offsetMinutes` but returns directly a `CVDateTime` or throws in case of an error
|
2171
2177
|
*
|
2172
|
-
* @category
|
2178
|
+
* @category Offsetters
|
2173
2179
|
*/
|
2174
2180
|
exports.offsetMinutes = offsetMinutes;
|
2175
2181
|
const offsetMinutesOrThrow = exports.offsetMinutesOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetMinutes, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2176
2182
|
/**
|
2177
|
-
*
|
2183
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` seconds. Returns a `Left`
|
2184
|
+
* of an error otherwise.
|
2178
2185
|
*
|
2179
2186
|
* @category Offsetters
|
2180
2187
|
*/
|
2181
2188
|
const offsetSeconds = offset => offsetMilliseconds(offset * SECOND_MS);
|
2182
2189
|
/**
|
2183
|
-
* Same as offsetSeconds but returns directly a
|
2190
|
+
* Same as `offsetSeconds` but returns directly a `CVDateTime` or throws in case of an error
|
2184
2191
|
*
|
2185
|
-
* @category
|
2192
|
+
* @category Offsetters
|
2186
2193
|
*/
|
2187
2194
|
exports.offsetSeconds = offsetSeconds;
|
2188
2195
|
const offsetSecondsOrThrow = exports.offsetSecondsOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetSeconds, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|
2189
2196
|
/**
|
2190
|
-
*
|
2197
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` milliseconds. Returns a
|
2198
|
+
* `Left` of an error otherwise.
|
2191
2199
|
*
|
2192
2200
|
* @category Offsetters
|
2193
2201
|
*/
|
2194
2202
|
const offsetMilliseconds = offset => self => _setTimestamp(timestamp(self) + offset)(self);
|
2195
2203
|
/**
|
2196
|
-
* Same as offsetMilliseconds but returns directly a
|
2204
|
+
* Same as `offsetMilliseconds` but returns directly a `CVDateTime` or throws in case of an error
|
2197
2205
|
*
|
2198
|
-
* @category
|
2206
|
+
* @category Offsetters
|
2199
2207
|
*/
|
2200
2208
|
exports.offsetMilliseconds = offsetMilliseconds;
|
2201
2209
|
const offsetMillisecondsOrThrow = exports.offsetMillisecondsOrThrow = /*#__PURE__*/(0, _effect.flow)(offsetMilliseconds, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
|