@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/esm/DateTime.js
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
/**
|
2
|
-
* This module implements an immutable
|
2
|
+
* This module implements an immutable `CVDateTime` object.
|
3
3
|
*
|
4
|
-
*
|
5
|
-
*
|
4
|
+
* `CVDateTime` objects keep an internal state. But all provided functions are pure insofar as they
|
5
|
+
* always yield the same result whatever the state the object is in. The state is only used to
|
6
6
|
* improve performance but does not alter the results.
|
7
7
|
*
|
8
|
-
* Unlike the Javascript Date objects and the Effect DateTime objects,
|
9
|
-
* the Gregorian and Iso calendars. So you can easily get/set the iso year and iso week
|
10
|
-
*
|
8
|
+
* Unlike the Javascript `Date` objects and the Effect `DateTime` objects, `CVDateTime` objects
|
9
|
+
* handle both the Gregorian and Iso calendars. So you can easily get/set the iso year and iso week
|
10
|
+
* of a `CVDateTime` object.
|
11
11
|
*
|
12
|
-
* A
|
13
|
-
* local zone and UTC time (e.g zoneOffset=1 for timezone +1:00). All the data in a
|
14
|
-
* is `zoneOffset-dependent`, except `timestamp`. An important thing to note is that a
|
15
|
-
* object with a timestamp t and a zoneOffset zo has exactly the same date parts
|
16
|
-
* month
|
17
|
-
* That's the reason for the _zonedTimestamp field
|
18
|
-
* performed UTC using _zonedTimestamp instead
|
12
|
+
* A `CVDateTime` object has a `zoneOffset` which is the difference in hours between the time in the
|
13
|
+
* local zone and UTC time (e.g `zoneOffset=1` for timezone +1:00). All the data in a `CVDateTime`
|
14
|
+
* object is `zoneOffset-dependent`, except `timestamp`. An important thing to note is that a
|
15
|
+
* `CVDateTime` object with a timestamp `t` and a zoneOffset `zo` has exactly the same date parts
|
16
|
+
* (`year`, `ordinalDay`, `month`, `monthDay`, `isoYear`...) as a `CVDateTime` object with
|
17
|
+
* `timestamp = t+zox3600` and `zoneOffset = 0`. That's the reason for the _zonedTimestamp field
|
18
|
+
* which is equal to `t+zox3600`. All calculations are performed UTC using _zonedTimestamp instead
|
19
|
+
* of timestamp.
|
19
20
|
*/
|
20
21
|
import { MArray, MFunction, MInputError, MInspectable, MNumber, MPipeable, MStruct, MTypes } from '@parischap/effect-lib';
|
21
22
|
import { DateTime, Either, Equal, Function, Hash, Number, Option, Predicate, Struct, flow, pipe } from 'effect';
|
@@ -358,7 +359,7 @@ var GregorianDate;
|
|
358
359
|
/**
|
359
360
|
* Returns the `yearIsLeap` property of `self`
|
360
361
|
*
|
361
|
-
* @category
|
362
|
+
* @category Predicates
|
362
363
|
*/
|
363
364
|
GregorianDate.yearIsLeap = /*#__PURE__*/Struct.get('yearIsLeap');
|
364
365
|
/**
|
@@ -710,7 +711,7 @@ var IsoDate;
|
|
710
711
|
/**
|
711
712
|
* Returns the `yearIsLong` property of `self`
|
712
713
|
*
|
713
|
-
* @category
|
714
|
+
* @category Predicates
|
714
715
|
*/
|
715
716
|
IsoDate.yearIsLong = /*#__PURE__*/Struct.get('yearIsLong');
|
716
717
|
/**
|
@@ -1206,9 +1207,9 @@ const _uncalculatedFromZonedTimestamp = (zonedTimestamp, zoneOffset) => _make({
|
|
1206
1207
|
/** Instance of an uncalculated DateTime that represents 1/1/1970 00:00:00:000+0:00 */
|
1207
1208
|
const _uncalculatedOrigin = /*#__PURE__*/_uncalculatedFromTimestamp(0, 0);
|
1208
1209
|
/**
|
1209
|
-
* Tries to build a
|
1210
|
+
* Tries to build a `CVDateTime` from `timestamp`, the number of milliseconds since 1/1/1970
|
1210
1211
|
* 00:00:00:000+0:00, and `zoneOffset` which gives the offset between the local time and the UTC
|
1211
|
-
* time. Returns a `
|
1212
|
+
* time. Returns a `Right` if successful, a `Left` otherwise.
|
1212
1213
|
*
|
1213
1214
|
* `timestamp` must be greater than or equal to MIN_TIMESTAMP and less than or equal to
|
1214
1215
|
* MAX_TIMESTAMP.
|
@@ -1236,20 +1237,20 @@ const _uncalculatedOrigin = /*#__PURE__*/_uncalculatedFromTimestamp(0, 0);
|
|
1236
1237
|
*/
|
1237
1238
|
export const fromTimestamp = (timestamp, zoneOffset) => pipe(_uncalculatedOrigin, _setTimestamp(timestamp), Either.flatMap(setZoneOffsetKeepTimestamp(zoneOffset)));
|
1238
1239
|
/**
|
1239
|
-
* Same as fromTimestamp but returns directly
|
1240
|
+
* Same as `fromTimestamp` but returns directly a `CVDateTime` or throws if it cannot be built
|
1240
1241
|
*
|
1241
1242
|
* @category Constructors
|
1242
1243
|
*/
|
1243
1244
|
export const fromTimestampOrThrow = /*#__PURE__*/flow(fromTimestamp, /*#__PURE__*/Either.getOrThrowWith(Function.identity));
|
1244
1245
|
/**
|
1245
|
-
* Builds a
|
1246
|
+
* Builds a `CVDateTime` using Date.now() as `timestamp`. `zoneOffset` is set to 0.
|
1246
1247
|
*
|
1247
1248
|
* @category Constructors
|
1248
1249
|
*/
|
1249
1250
|
export const now = () => _uncalculatedFromTimestamp(Date.now(), 0);
|
1250
1251
|
/**
|
1251
|
-
* Tries to build a
|
1252
|
-
*
|
1252
|
+
* Tries to build a `CVDateTime` from the provided parts. Returns a `Right` if successful, a `Left`
|
1253
|
+
* otherwise.
|
1253
1254
|
*
|
1254
1255
|
* `year` must comprised in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. `ordinalDay` must be greater
|
1255
1256
|
* than or equal to 1 and less than or equal to the number of days in the current year. `month` must
|
@@ -1443,31 +1444,31 @@ export const fromParts = ({
|
|
1443
1444
|
return withWeekday;
|
1444
1445
|
});
|
1445
1446
|
/**
|
1446
|
-
* Same as fromParts but returns directly
|
1447
|
+
* Same as `fromParts` but returns directly a `CVDateTime` or throws if it cannot be built
|
1447
1448
|
*
|
1448
1449
|
* @category Constructors
|
1449
1450
|
*/
|
1450
1451
|
export const fromPartsOrThrow = /*#__PURE__*/flow(fromParts, /*#__PURE__*/Either.getOrThrowWith(Function.identity));
|
1451
1452
|
/**
|
1452
|
-
* Builds a CVDateTime from a Javascript Date
|
1453
|
+
* Builds a `CVDateTime` from a Javascript `Date`
|
1453
1454
|
*
|
1454
1455
|
* @category Constructors
|
1455
1456
|
*/
|
1456
1457
|
export const fromDate = date => fromTimestampOrThrow(date.getTime());
|
1457
1458
|
/**
|
1458
|
-
* Builds a CVDateTime from an Effect
|
1459
|
+
* Builds a `CVDateTime` from an `Effect.DateTime.Zoned`
|
1459
1460
|
*
|
1460
1461
|
* @category Constructors
|
1461
1462
|
*/
|
1462
1463
|
export const fromEffectDateTime = date => fromTimestampOrThrow(DateTime.toEpochMillis(date), DateTime.zonedOffset(date));
|
1463
1464
|
/**
|
1464
|
-
* Builds a Javascript Date from a CVDateTime
|
1465
|
+
* Builds a Javascript `Date` from a `CVDateTime`
|
1465
1466
|
*
|
1466
1467
|
* @category Conversions
|
1467
1468
|
*/
|
1468
1469
|
export const toDate = self => new Date(timestamp(self));
|
1469
1470
|
/**
|
1470
|
-
* Builds an Effect
|
1471
|
+
* Builds an `Effect.DateTime.Zoned` from a `CVDateTime`
|
1471
1472
|
*
|
1472
1473
|
* @category Conversions
|
1473
1474
|
*/
|
@@ -1480,7 +1481,7 @@ export const toEffectDateTime = self => DateTime.unsafeMakeZoned(timestamp(self)
|
|
1480
1481
|
* @category Getters
|
1481
1482
|
*/
|
1482
1483
|
export const timestamp = /*#__PURE__*/Struct.get('timestamp');
|
1483
|
-
/** Returns the gregorianDate of `self` for the given time zone */
|
1484
|
+
/** Returns the `gregorianDate` of `self` for the given time zone */
|
1484
1485
|
const _gregorianDate = self => pipe(self.gregorianDate, Option.getOrElse(() => {
|
1485
1486
|
const result = GregorianDate.fromTimestamp(self._zonedTimestamp);
|
1486
1487
|
/* eslint-disable-next-line functional/immutable-data, functional/no-expression-statements */
|
@@ -1493,13 +1494,6 @@ const _gregorianDate = self => pipe(self.gregorianDate, Option.getOrElse(() => {
|
|
1493
1494
|
* @category Getters
|
1494
1495
|
*/
|
1495
1496
|
export const getYear = /*#__PURE__*/flow(_gregorianDate, GregorianDate.year);
|
1496
|
-
/**
|
1497
|
-
* Returns true if the (Gregorian) year of `self` for the given time zone is a leap year. Returns
|
1498
|
-
* false otherwise
|
1499
|
-
*
|
1500
|
-
* @category Getters
|
1501
|
-
*/
|
1502
|
-
export const yearIsLeap = /*#__PURE__*/flow(_gregorianDate, GregorianDate.yearIsLeap);
|
1503
1497
|
/**
|
1504
1498
|
* Returns the ordinalDay of `self` for the given time zone
|
1505
1499
|
*
|
@@ -1531,13 +1525,6 @@ const _isoDate = self => pipe(self.isoDate, Option.getOrElse(() => {
|
|
1531
1525
|
* @category Getters
|
1532
1526
|
*/
|
1533
1527
|
export const getIsoYear = /*#__PURE__*/flow(_isoDate, IsoDate.year);
|
1534
|
-
/**
|
1535
|
-
* Returns true if the isoYear of `self` for the given time zone is a long year. Returns false
|
1536
|
-
* otherwise
|
1537
|
-
*
|
1538
|
-
* @category Getters
|
1539
|
-
*/
|
1540
|
-
export const isoYearIsLong = /*#__PURE__*/flow(_isoDate, IsoDate.yearIsLong);
|
1541
1528
|
/**
|
1542
1529
|
* Returns the isoWeek of `self` for the given time zone
|
1543
1530
|
*
|
@@ -1654,53 +1641,53 @@ const _timeSetter = self => {
|
|
1654
1641
|
};
|
1655
1642
|
};
|
1656
1643
|
/**
|
1657
|
-
* If possible, returns a
|
1658
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1659
|
-
*
|
1644
|
+
* If possible, returns a `Right` of a `CVDateTime` having year `year` and the same `month`,
|
1645
|
+
* `monthDay`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1646
|
+
* `Left` otherwise. `year` must be an integer comprised in the range [MIN_FULL_YEAR,
|
1660
1647
|
* MAX_FULL_YEAR].
|
1661
1648
|
*
|
1662
1649
|
* @category Setters
|
1663
1650
|
*/
|
1664
1651
|
export const setYear = year => self => pipe(self, _gregorianDate, GregorianDate.setYear(year), Either.map(_gregorianDateSetter(self)));
|
1665
1652
|
/**
|
1666
|
-
* Same as setYear but returns directly a
|
1653
|
+
* Same as `setYear` but returns directly a `CVDateTime` or throws in case of an error
|
1667
1654
|
*
|
1668
1655
|
* @category Setters
|
1669
1656
|
*/
|
1670
1657
|
export const setYearOrThrow = /*#__PURE__*/flow(setYear, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1671
1658
|
/**
|
1672
|
-
* If possible, returns a
|
1673
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1674
|
-
* error otherwise. `ordinalDay` must be an integer greater than or equal to 1 and less than
|
1675
|
-
* equal to the number of days in the current year
|
1659
|
+
* If possible, returns a `Right` of a `CVDateTime` having ordinalDay `ordinalDay` and the same
|
1660
|
+
* `year`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
1661
|
+
* of an error otherwise. `ordinalDay` must be an integer greater than or equal to 1 and less than
|
1662
|
+
* or equal to the number of days in the current year
|
1676
1663
|
*
|
1677
1664
|
* @category Setters
|
1678
1665
|
*/
|
1679
1666
|
export const setOrdinalDay = ordinalDay => self => pipe(self, _gregorianDate, GregorianDate.setOrdinalDay(ordinalDay), Either.map(_gregorianDateSetter(self)));
|
1680
1667
|
/**
|
1681
|
-
* Same as setOrdinalDay but returns directly a
|
1668
|
+
* Same as `setOrdinalDay` but returns directly a `CVDateTime` or throws in case of an error
|
1682
1669
|
*
|
1683
1670
|
* @category Setters
|
1684
1671
|
*/
|
1685
1672
|
export const setOrdinalDayOrThrow = /*#__PURE__*/flow(setOrdinalDay, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1686
1673
|
/**
|
1687
|
-
* If possible, returns a
|
1688
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1689
|
-
* error otherwise. `month` must be an integer greater than or equal to 1 (January) and
|
1690
|
-
* equal to 12 (December)
|
1674
|
+
* If possible, returns a `Right` of a `CVDateTime` having month `month` and the same `year`,
|
1675
|
+
* `monthDay`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1676
|
+
* `Left` of an error otherwise. `month` must be an integer greater than or equal to 1 (January) and
|
1677
|
+
* less than or equal to 12 (December)
|
1691
1678
|
*
|
1692
1679
|
* @category Setters
|
1693
1680
|
*/
|
1694
1681
|
export const setMonth = month => self => pipe(self, _gregorianDate, GregorianDate.setMonth(month), Either.map(_gregorianDateSetter(self)));
|
1695
1682
|
/**
|
1696
|
-
* Same as setMonth but returns directly a
|
1683
|
+
* Same as `setMonth` but returns directly a `CVDateTime` or throws in case of an error
|
1697
1684
|
*
|
1698
1685
|
* @category Setters
|
1699
1686
|
*/
|
1700
1687
|
export const setMonthOrThrow = /*#__PURE__*/flow(setMonth, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1701
1688
|
/**
|
1702
|
-
* If possible, returns a
|
1703
|
-
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1689
|
+
* If possible, returns a `Right` of a `CVDateTime` having monthDay `monthDay` and the same `year`,
|
1690
|
+
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
1704
1691
|
* of an error otherwise. `monthDay` must be an integer greater than or equal to 1 and less than or
|
1705
1692
|
* equal to the number of days in the current month.
|
1706
1693
|
*
|
@@ -1708,59 +1695,59 @@ export const setMonthOrThrow = /*#__PURE__*/flow(setMonth, /*#__PURE__*/Function
|
|
1708
1695
|
*/
|
1709
1696
|
export const setMonthDay = monthDay => self => pipe(self, _gregorianDate, GregorianDate.setMonthDay(monthDay), Either.map(_gregorianDateSetter(self)));
|
1710
1697
|
/**
|
1711
|
-
* Same as setMonthDay but returns directly a
|
1698
|
+
* Same as `setMonthDay` but returns directly a `CVDateTime` or throws in case of an error
|
1712
1699
|
*
|
1713
1700
|
* @category Setters
|
1714
1701
|
*/
|
1715
1702
|
export const setMonthDayOrThrow = /*#__PURE__*/flow(setMonthDay, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1716
1703
|
/**
|
1717
|
-
* If possible, returns a
|
1704
|
+
* If possible, returns a `Right` of a `CVDateTime` having isoYear `isoYear` and the same `isoWeek`,
|
1718
1705
|
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1719
|
-
* `
|
1706
|
+
* `Left` of an error otherwise. `isoYear` must be an integer comprised in the range [MIN_FULL_YEAR,
|
1720
1707
|
* MAX_FULL_YEAR].
|
1721
1708
|
*
|
1722
1709
|
* @category Setters
|
1723
1710
|
*/
|
1724
1711
|
export const setIsoYear = isoYear => self => pipe(self, _isoDate, IsoDate.setYear(isoYear), Either.map(_isoDateSetter(self)));
|
1725
1712
|
/**
|
1726
|
-
* Same as setIsoYear but returns directly a
|
1713
|
+
* Same as `setIsoYear` but returns directly a `CVDateTime` or throws in case of an error
|
1727
1714
|
*
|
1728
1715
|
* @category Setters
|
1729
1716
|
*/
|
1730
1717
|
export const setIsoYearOrThrow = /*#__PURE__*/flow(setIsoYear, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1731
1718
|
/**
|
1732
|
-
* If possible, returns a
|
1719
|
+
* If possible, returns a Right of a `CVDateTime` having isoWeek `isoWeek` and the same `isoYear`,
|
1733
1720
|
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1734
|
-
* `
|
1721
|
+
* `Left` of an error otherwise. `isoWeek` must be an integer greater than or equal to 1 and less
|
1735
1722
|
* than or equal to the number of iso weeks in the current year.
|
1736
1723
|
*
|
1737
1724
|
* @category Setters
|
1738
1725
|
*/
|
1739
1726
|
export const setIsoWeek = isoWeek => self => pipe(self, _isoDate, IsoDate.setIsoWeek(isoWeek), Either.map(_isoDateSetter(self)));
|
1740
1727
|
/**
|
1741
|
-
* Same as setIsoWeek but returns directly a
|
1728
|
+
* Same as `setIsoWeek` but returns directly a `CVDateTime` or throws in case of an error
|
1742
1729
|
*
|
1743
1730
|
* @category Setters
|
1744
1731
|
*/
|
1745
1732
|
export const setIsoWeekOrThrow = /*#__PURE__*/flow(setIsoWeek, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1746
1733
|
/**
|
1747
|
-
* If possible, returns a
|
1734
|
+
* If possible, returns a `Right` of a `CVDateTime` having weekday `weekday` and the same `isoYear`,
|
1748
1735
|
* `isoWeek`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1749
|
-
* `
|
1736
|
+
* `Left` of an error otherwise. `weekday` must be an integer greater than or equal to 1 (monday)
|
1750
1737
|
* and less than or equal to 7 (sunday).
|
1751
1738
|
*
|
1752
1739
|
* @category Setters
|
1753
1740
|
*/
|
1754
1741
|
export const setWeekday = weekday => self => pipe(self, _isoDate, IsoDate.setWeekday(weekday), Either.map(_isoDateSetter(self)));
|
1755
1742
|
/**
|
1756
|
-
* Same as setWeekday but returns directly a
|
1743
|
+
* Same as `setWeekday` but returns directly a `CVDateTime` or throws in case of an error
|
1757
1744
|
*
|
1758
1745
|
* @category Setters
|
1759
1746
|
*/
|
1760
1747
|
export const setWeekdayOrThrow = /*#__PURE__*/flow(setWeekday, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1761
1748
|
/**
|
1762
|
-
* If possible, returns a
|
1763
|
-
* `ordinalDay`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1749
|
+
* If possible, returns a `Right` of a `CVDateTime` having hour23 `hour23` and the same `year`,
|
1750
|
+
* `ordinalDay`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1764
1751
|
* an error otherwise. `hour23` must be an integer greater than or equal to 0 and less than or equal
|
1765
1752
|
* to 23
|
1766
1753
|
*
|
@@ -1768,36 +1755,36 @@ export const setWeekdayOrThrow = /*#__PURE__*/flow(setWeekday, /*#__PURE__*/Func
|
|
1768
1755
|
*/
|
1769
1756
|
export const setHour23 = hour23 => self => pipe(self, _time, Time.setHour23(hour23), Either.map(_timeSetter(self)));
|
1770
1757
|
/**
|
1771
|
-
* Same as setHour23 but returns directly a
|
1758
|
+
* Same as `setHour23` but returns directly a `CVDateTime` or throws in case of an error
|
1772
1759
|
*
|
1773
1760
|
* @category Setters
|
1774
1761
|
*/
|
1775
1762
|
export const setHour23OrThrow = /*#__PURE__*/flow(setHour23, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1776
1763
|
/**
|
1777
|
-
* If possible, returns a
|
1764
|
+
* If possible, returns a Right of a `CVDateTime` having hour11 `hour11` and the same `year`,
|
1778
1765
|
* `ordinalDay`, `meridiem`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1779
|
-
* `
|
1766
|
+
* `Left` of an error otherwise. `hour11` must be an integer greater than or equal to 0 and less
|
1780
1767
|
* than or equal to 11.
|
1781
1768
|
*
|
1782
1769
|
* @category Setters
|
1783
1770
|
*/
|
1784
1771
|
export const setHour11 = hour11 => self => pipe(self, _time, Time.setHour11(hour11), Either.map(_timeSetter(self)));
|
1785
1772
|
/**
|
1786
|
-
* Same as setHour11 but returns directly a
|
1773
|
+
* Same as `setHour11` but returns directly a `CVDateTime` or throws in case of an error
|
1787
1774
|
*
|
1788
1775
|
* @category Setters
|
1789
1776
|
*/
|
1790
1777
|
export const setHour11OrThrow = /*#__PURE__*/flow(setHour11, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1791
1778
|
/**
|
1792
|
-
* Returns a
|
1779
|
+
* Returns a `CVDateTime` having meridiem `meridiem` and the same `year`, `ordinalDay`, `hour11`,
|
1793
1780
|
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`
|
1794
1781
|
*
|
1795
1782
|
* @category Setters
|
1796
1783
|
*/
|
1797
1784
|
export const setMeridiem = meridiem => self => pipe(self, _time, Time.setMeridiem(meridiem), _timeSetter(self));
|
1798
1785
|
/**
|
1799
|
-
* If possible, returns a
|
1800
|
-
* `ordinalDay`, `hour23`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1786
|
+
* If possible, returns a `Right` of a `CVDateTime` having minute `minute` and the same `year`,
|
1787
|
+
* `ordinalDay`, `hour23`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1801
1788
|
* an error otherwise. `minute` must be an integer greater than or equal to 0 and less than or equal
|
1802
1789
|
* to 59
|
1803
1790
|
*
|
@@ -1805,14 +1792,14 @@ export const setMeridiem = meridiem => self => pipe(self, _time, Time.setMeridie
|
|
1805
1792
|
*/
|
1806
1793
|
export const setMinute = minute => self => pipe(self, _time, Time.setMinute(minute), Either.map(_timeSetter(self)));
|
1807
1794
|
/**
|
1808
|
-
* Same as setMinute but returns directly a
|
1795
|
+
* Same as `setMinute` but returns directly a `CVDateTime` or throws in case of an error
|
1809
1796
|
*
|
1810
1797
|
* @category Setters
|
1811
1798
|
*/
|
1812
1799
|
export const setMinuteOrThrow = /*#__PURE__*/flow(setMinute, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1813
1800
|
/**
|
1814
|
-
* If possible, returns a
|
1815
|
-
* `ordinalDay`, `hour23`, `minute`, `millisecond` and `zoneOffset` as `self`. Returns a `
|
1801
|
+
* If possible, returns a Right of a `CVDateTime` having second `second` and the same `year`,
|
1802
|
+
* `ordinalDay`, `hour23`, `minute`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of
|
1816
1803
|
* an error otherwise. `second` must be an integer greater than or equal to 0 and less than or equal
|
1817
1804
|
* to 59
|
1818
1805
|
*
|
@@ -1820,29 +1807,29 @@ export const setMinuteOrThrow = /*#__PURE__*/flow(setMinute, /*#__PURE__*/Functi
|
|
1820
1807
|
*/
|
1821
1808
|
export const setSecond = second => self => pipe(self, _time, Time.setSecond(second), Either.map(_timeSetter(self)));
|
1822
1809
|
/**
|
1823
|
-
* Same as setSecond but returns directly a
|
1810
|
+
* Same as `setSecond` but returns directly a `CVDateTime` or throws in case of an error
|
1824
1811
|
*
|
1825
1812
|
* @category Setters
|
1826
1813
|
*/
|
1827
1814
|
export const setSecondOrThrow = /*#__PURE__*/flow(setSecond, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1828
1815
|
/**
|
1829
|
-
* If possible, returns a
|
1830
|
-
* `ordinalDay`, `hour23`, `minute`, `second` and `zoneOffset` as `self`. Returns a `
|
1831
|
-
* error otherwise. `millisecond` must be an integer greater than or equal to 0 and less than
|
1832
|
-
* equal to 999.
|
1816
|
+
* If possible, returns a `Right` of a `CVDateTime` having millisecond `millisecond` and the same
|
1817
|
+
* `year`, `ordinalDay`, `hour23`, `minute`, `second` and `zoneOffset` as `self`. Returns a `Left`
|
1818
|
+
* of an error otherwise. `millisecond` must be an integer greater than or equal to 0 and less than
|
1819
|
+
* or equal to 999.
|
1833
1820
|
*
|
1834
1821
|
* @category Setters
|
1835
1822
|
*/
|
1836
1823
|
export const setMillisecond = millisecond => self => pipe(self, _time, Time.setMillisecond(millisecond), Either.map(_timeSetter(self)));
|
1837
1824
|
/**
|
1838
|
-
* Same as setMillisecond but returns directly a
|
1825
|
+
* Same as `setMillisecond` but returns directly a `CVDateTime` or throws in case of an error
|
1839
1826
|
*
|
1840
1827
|
* @category Setters
|
1841
1828
|
*/
|
1842
1829
|
export const setMillisecondOrThrow = /*#__PURE__*/flow(setMillisecond, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1843
1830
|
/**
|
1844
|
-
* If possible, returns a
|
1845
|
-
* `
|
1831
|
+
* If possible, returns a `Right` of a copy of `self` with timestamp set to `timestamp`. Returns a
|
1832
|
+
* `Left` of an error otherwise. `timestamp` must be an integer comprised in the range
|
1846
1833
|
* [MIN_TIMESTAMP, MAX_TIMESTAMP] representing the number of milliseconds since 1/1/1970
|
1847
1834
|
* 00:00:00:000+0:00.
|
1848
1835
|
*/
|
@@ -1877,8 +1864,8 @@ const _setZoneOffset = (keepTimestamp, zoneOffset = LOCAL_TIME_ZONE_OFFSET) => s
|
|
1877
1864
|
return result;
|
1878
1865
|
});
|
1879
1866
|
/**
|
1880
|
-
* If possible, returns a
|
1881
|
-
* `zoneOffset`.
|
1867
|
+
* If possible, returns a `Right` of a copy of `self` with the same `timestamp` and zoneOffset set
|
1868
|
+
* to `zoneOffset`.
|
1882
1869
|
*
|
1883
1870
|
* If `zoneOffset` is omitted, the local time zone offset of the machine this code is running on is
|
1884
1871
|
* used.
|
@@ -1899,58 +1886,74 @@ const _setZoneOffset = (keepTimestamp, zoneOffset = LOCAL_TIME_ZONE_OFFSET) => s
|
|
1899
1886
|
*/
|
1900
1887
|
export const setZoneOffsetKeepTimestamp = zoneOffset => _setZoneOffset(true, zoneOffset);
|
1901
1888
|
/**
|
1902
|
-
* Same as setZoneOffsetKeepTimestamp but returns directly a
|
1889
|
+
* Same as `setZoneOffsetKeepTimestamp` but returns directly a `CVDateTime` or throws in case of an
|
1890
|
+
* error
|
1903
1891
|
*
|
1904
1892
|
* @category Setters
|
1905
1893
|
*/
|
1906
1894
|
export const setZoneOffsetKeepTimestampOrThrow = /*#__PURE__*/flow(setZoneOffsetKeepTimestamp, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1907
1895
|
/**
|
1908
|
-
* If possible, returns a
|
1909
|
-
* zoneOffset
|
1896
|
+
* If possible, returns a `Right` of a copy of `self` with the same parts (except `zoneOffset`) and
|
1897
|
+
* zoneOffset set to `zoneOffset`.
|
1910
1898
|
*
|
1911
|
-
* See setZoneOffsetKeepTimestamp for more details
|
1899
|
+
* See `setZoneOffsetKeepTimestamp` for more details
|
1912
1900
|
*
|
1913
1901
|
* @category Setters
|
1914
1902
|
*/
|
1915
1903
|
export const setZoneOffsetKeepParts = zoneOffset => _setZoneOffset(false, zoneOffset);
|
1916
1904
|
/**
|
1917
|
-
* Same as setZoneOffsetKeepTimestamp but returns directly a
|
1905
|
+
* Same as `setZoneOffsetKeepTimestamp` but returns directly a `CVDateTime` or throws in case of an
|
1906
|
+
* error
|
1918
1907
|
*
|
1919
1908
|
* @category Setters
|
1920
1909
|
*/
|
1921
1910
|
export const setZoneOffsetKeepPartsOrThrow = /*#__PURE__*/flow(setZoneOffsetKeepParts, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
1922
1911
|
/**
|
1923
|
-
* Returns true if self
|
1912
|
+
* Returns true if the (Gregorian) year of `self` for the given time zone is a leap year. Returns
|
1913
|
+
* false otherwise
|
1914
|
+
*
|
1915
|
+
* @category Predicates
|
1916
|
+
*/
|
1917
|
+
export const yearIsLeap = /*#__PURE__*/flow(_gregorianDate, GregorianDate.yearIsLeap);
|
1918
|
+
/**
|
1919
|
+
* Returns true if the isoYear of `self` for the given time zone is a long year. Returns false
|
1920
|
+
* otherwise
|
1921
|
+
*
|
1922
|
+
* @category Predicates
|
1923
|
+
*/
|
1924
|
+
export const isoYearIsLong = /*#__PURE__*/flow(_isoDate, IsoDate.yearIsLong);
|
1925
|
+
/**
|
1926
|
+
* Returns true if `self` is the first day of a month in the given timezone
|
1924
1927
|
*
|
1925
1928
|
* @category Predicates
|
1926
1929
|
*/
|
1927
1930
|
export const isFirstMonthDay = self => getMonthDay(self) === 1;
|
1928
1931
|
/**
|
1929
|
-
* Returns true if self is the last day of a month in the given timezone
|
1932
|
+
* Returns true if `self` is the last day of a month in the given timezone
|
1930
1933
|
*
|
1931
1934
|
* @category Predicates
|
1932
1935
|
*/
|
1933
1936
|
export const isLastMonthDay = self => getMonthDay(self) === pipe(self, _gregorianDate, GregorianDate.getNumberOfDaysInMonth(getMonth(self)));
|
1934
1937
|
/**
|
1935
|
-
* Returns true if self is the first day of a year in the given timezone
|
1938
|
+
* Returns true if `self` is the first day of a year in the given timezone
|
1936
1939
|
*
|
1937
1940
|
* @category Predicates
|
1938
1941
|
*/
|
1939
1942
|
export const isFirstYearDay = self => getOrdinalDay(self) === 1;
|
1940
1943
|
/**
|
1941
|
-
* Returns true if self is the last day of a year in the given timezone
|
1944
|
+
* Returns true if `self` is the last day of a year in the given timezone
|
1942
1945
|
*
|
1943
1946
|
* @category Predicates
|
1944
1947
|
*/
|
1945
1948
|
export const isLastYearDay = self => getOrdinalDay(self) === pipe(self, _gregorianDate, GregorianDate.getYearDurationInDays);
|
1946
1949
|
/**
|
1947
|
-
* Returns true if self is the first day of an iso year in the given timezone
|
1950
|
+
* Returns true if `self` is the first day of an iso year in the given timezone
|
1948
1951
|
*
|
1949
1952
|
* @category Predicates
|
1950
1953
|
*/
|
1951
1954
|
export const isFirstIsoYearDay = self => getIsoWeek(self) === 1 && getWeekday(self) === 1;
|
1952
1955
|
/**
|
1953
|
-
* Returns true if self is the last day of an iso year in the given timezone
|
1956
|
+
* Returns true if `self` is the last day of an iso year in the given timezone
|
1954
1957
|
*
|
1955
1958
|
* @category Predicates
|
1956
1959
|
*/
|
@@ -2007,27 +2010,27 @@ export const toLastIsoYearWeek = self => pipe(self, setIsoWeekOrThrow(pipe(self,
|
|
2007
2010
|
*/
|
2008
2011
|
export const toLastIsoYearDay = self => pipe(self, toLastIsoYearWeek, setWeekdayOrThrow(7));
|
2009
2012
|
/**
|
2010
|
-
* If possible, returns a copy of `self` offset by `offset` years and having the same
|
2011
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2012
|
-
* true and `self` is on the last day of a month, the
|
2013
|
-
* last of the target month. Otherwise, it will be the
|
2014
|
-
*
|
2013
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` years and having the same
|
2014
|
+
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left`
|
2015
|
+
* of an error otherwise. If `respectMonthEnd` is true and `self` is on the last day of a month, the
|
2016
|
+
* new DateTime object's monthDay will be the last of the target month. Otherwise, it will be the
|
2017
|
+
* same as `self`
|
2015
2018
|
*
|
2016
2019
|
* @category Offsetters
|
2017
2020
|
*/
|
2018
2021
|
export const offsetYears = (offset, respectMonthEnd) => offsetMonths(offset * 12, respectMonthEnd);
|
2019
2022
|
/**
|
2020
|
-
* Same as offsetYears but returns directly a
|
2023
|
+
* Same as `offsetYears` but returns directly a `CVDateTime` or throws in case of an error
|
2021
2024
|
*
|
2022
|
-
* @category
|
2025
|
+
* @category Offsetters
|
2023
2026
|
*/
|
2024
2027
|
export const offsetYearsOrThrow = /*#__PURE__*/flow(offsetYears, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2025
2028
|
/**
|
2026
|
-
* If possible, returns a copy of `self` offset by `offset` months and having the same
|
2027
|
-
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2028
|
-
* `self` is on the last day of a month, the new
|
2029
|
-
*
|
2030
|
-
*
|
2029
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` months and having the same
|
2030
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `Left` of an
|
2031
|
+
* error otherwise. If `respectMonthEnd` is true and `self` is on the last day of a month, the new
|
2032
|
+
* DateTime object's monthDay will be the last of the target month. Otherwise, it will be the same
|
2033
|
+
* as `self`'s
|
2031
2034
|
*
|
2032
2035
|
* @category Offsetters
|
2033
2036
|
*/
|
@@ -2040,29 +2043,30 @@ export const offsetMonths = (offset, respectMonthEnd) => self => {
|
|
2040
2043
|
})));
|
2041
2044
|
};
|
2042
2045
|
/**
|
2043
|
-
* Same as offsetMonths but returns directly a
|
2046
|
+
* Same as `offsetMonths` but returns directly a `CVDateTime` or throws in case of an error
|
2044
2047
|
*
|
2045
|
-
* @category
|
2048
|
+
* @category Offsetters
|
2046
2049
|
*/
|
2047
2050
|
export const offsetMonthsOrThrow = /*#__PURE__*/flow(offsetMonths, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2048
2051
|
/**
|
2049
|
-
*
|
2052
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` days. Returns a `Left` of
|
2053
|
+
* an error otherwise.
|
2050
2054
|
*
|
2051
2055
|
* @category Offsetters
|
2052
2056
|
*/
|
2053
2057
|
export const offsetDays = offset => offsetMilliseconds(offset * DAY_MS);
|
2054
2058
|
/**
|
2055
|
-
* Same as offsetDays but returns directly a
|
2059
|
+
* Same as `offsetDays` but returns directly a `CVDateTime` or throws in case of an error
|
2056
2060
|
*
|
2057
|
-
* @category
|
2061
|
+
* @category Offsetters
|
2058
2062
|
*/
|
2059
2063
|
export const offsetDaysOrThrow = /*#__PURE__*/flow(offsetDays, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2060
2064
|
/**
|
2061
|
-
* If possible, returns a copy of `self` offset by `offset` iso years and having the
|
2062
|
-
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`.
|
2063
|
-
* true and `self` is on the last day of an iso
|
2064
|
-
*
|
2065
|
-
*
|
2065
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` iso years and having the
|
2066
|
+
* same `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
2067
|
+
* `Left` of an error otherwise. If `respectYearEnd` is true and `self` is on the last day of an iso
|
2068
|
+
* year, the new DateTime object's isoWeek will be the last of the target iso year. Otherwise, it
|
2069
|
+
* will be the same as `self`'s.
|
2066
2070
|
*
|
2067
2071
|
* @category Offsetters
|
2068
2072
|
*/
|
@@ -2074,57 +2078,61 @@ export const offsetIsoYears = (offset, respectYearEnd) => self => {
|
|
2074
2078
|
})));
|
2075
2079
|
};
|
2076
2080
|
/**
|
2077
|
-
* Same as offsetIsoYears but returns directly a
|
2081
|
+
* Same as `offsetIsoYears` but returns directly a `CVDateTime` or throws in case of an error
|
2078
2082
|
*
|
2079
|
-
* @category
|
2083
|
+
* @category Offsetters
|
2080
2084
|
*/
|
2081
2085
|
export const offsetIsoYearsOrThrow = /*#__PURE__*/flow(offsetIsoYears, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2082
2086
|
/**
|
2083
|
-
*
|
2087
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` hours. Returns a `Left` of
|
2088
|
+
* an error otherwise.
|
2084
2089
|
*
|
2085
2090
|
* @category Offsetters
|
2086
2091
|
*/
|
2087
2092
|
export const offsetHours = offset => offsetMilliseconds(offset * HOUR_MS);
|
2088
2093
|
/**
|
2089
|
-
* Same as offsetHours but returns directly a
|
2094
|
+
* Same as `offsetHours` but returns directly a `CVDateTime` or throws in case of an error
|
2090
2095
|
*
|
2091
|
-
* @category
|
2096
|
+
* @category Offsetters
|
2092
2097
|
*/
|
2093
2098
|
export const offsetHoursOrThrow = /*#__PURE__*/flow(offsetHours, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2094
2099
|
/**
|
2095
|
-
*
|
2100
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` minutes. Returns a `Left`
|
2101
|
+
* of an error otherwise.
|
2096
2102
|
*
|
2097
2103
|
* @category Offsetters
|
2098
2104
|
*/
|
2099
2105
|
export const offsetMinutes = offset => offsetMilliseconds(offset * MINUTE_MS);
|
2100
2106
|
/**
|
2101
|
-
* Same as offsetMinutes but returns directly a
|
2107
|
+
* Same as `offsetMinutes` but returns directly a `CVDateTime` or throws in case of an error
|
2102
2108
|
*
|
2103
|
-
* @category
|
2109
|
+
* @category Offsetters
|
2104
2110
|
*/
|
2105
2111
|
export const offsetMinutesOrThrow = /*#__PURE__*/flow(offsetMinutes, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2106
2112
|
/**
|
2107
|
-
*
|
2113
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` seconds. Returns a `Left`
|
2114
|
+
* of an error otherwise.
|
2108
2115
|
*
|
2109
2116
|
* @category Offsetters
|
2110
2117
|
*/
|
2111
2118
|
export const offsetSeconds = offset => offsetMilliseconds(offset * SECOND_MS);
|
2112
2119
|
/**
|
2113
|
-
* Same as offsetSeconds but returns directly a
|
2120
|
+
* Same as `offsetSeconds` but returns directly a `CVDateTime` or throws in case of an error
|
2114
2121
|
*
|
2115
|
-
* @category
|
2122
|
+
* @category Offsetters
|
2116
2123
|
*/
|
2117
2124
|
export const offsetSecondsOrThrow = /*#__PURE__*/flow(offsetSeconds, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2118
2125
|
/**
|
2119
|
-
*
|
2126
|
+
* If possible, returns a `Right` of a copy of `self` offset by `offset` milliseconds. Returns a
|
2127
|
+
* `Left` of an error otherwise.
|
2120
2128
|
*
|
2121
2129
|
* @category Offsetters
|
2122
2130
|
*/
|
2123
2131
|
export const offsetMilliseconds = offset => self => _setTimestamp(timestamp(self) + offset)(self);
|
2124
2132
|
/**
|
2125
|
-
* Same as offsetMilliseconds but returns directly a
|
2133
|
+
* Same as `offsetMilliseconds` but returns directly a `CVDateTime` or throws in case of an error
|
2126
2134
|
*
|
2127
|
-
* @category
|
2135
|
+
* @category Offsetters
|
2128
2136
|
*/
|
2129
2137
|
export const offsetMillisecondsOrThrow = /*#__PURE__*/flow(offsetMilliseconds, /*#__PURE__*/Function.compose(/*#__PURE__*/Either.getOrThrowWith(Function.identity)));
|
2130
2138
|
//# sourceMappingURL=DateTime.js.map
|