@parischap/conversions 0.1.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/LICENSE +21 -0
- package/README.md +1304 -0
- package/cjs/BigDecimal.js +16 -0
- package/cjs/BigDecimal.js.map +1 -0
- package/cjs/BigInt.js +34 -0
- package/cjs/BigInt.js.map +1 -0
- package/cjs/DateTime.js +2202 -0
- package/cjs/DateTime.js.map +1 -0
- package/cjs/DateTimeFormat.js +269 -0
- package/cjs/DateTimeFormat.js.map +1 -0
- package/cjs/DateTimeFormatContext.js +327 -0
- package/cjs/DateTimeFormatContext.js.map +1 -0
- package/cjs/Email.js +73 -0
- package/cjs/Email.js.map +1 -0
- package/cjs/Integer.js +155 -0
- package/cjs/Integer.js.map +1 -0
- package/cjs/NumberBase10Format.js +759 -0
- package/cjs/NumberBase10Format.js.map +1 -0
- package/cjs/PositiveInteger.js +191 -0
- package/cjs/PositiveInteger.js.map +1 -0
- package/cjs/PositiveReal.js +162 -0
- package/cjs/PositiveReal.js.map +1 -0
- package/cjs/Real.js +113 -0
- package/cjs/Real.js.map +1 -0
- package/cjs/RoundingMode.js +86 -0
- package/cjs/RoundingMode.js.map +1 -0
- package/cjs/RoundingOption.js +152 -0
- package/cjs/RoundingOption.js.map +1 -0
- package/cjs/Schema.js +218 -0
- package/cjs/Schema.js.map +1 -0
- package/cjs/SemVer.js +73 -0
- package/cjs/SemVer.js.map +1 -0
- package/cjs/Template.js +189 -0
- package/cjs/Template.js.map +1 -0
- package/cjs/TemplatePart.js +51 -0
- package/cjs/TemplatePart.js.map +1 -0
- package/cjs/TemplateParts.js +46 -0
- package/cjs/TemplateParts.js.map +1 -0
- package/cjs/TemplatePlaceholder.js +381 -0
- package/cjs/TemplatePlaceholder.js.map +1 -0
- package/cjs/TemplateSeparator.js +116 -0
- package/cjs/TemplateSeparator.js.map +1 -0
- package/cjs/index.js +67 -0
- package/cjs/index.js.map +1 -0
- package/cjs/internal/Int.js +50 -0
- package/cjs/internal/Int.js.map +1 -0
- package/cjs/internal/Positive.js +50 -0
- package/cjs/internal/Positive.js.map +1 -0
- package/dts/BigDecimal.d.ts +11 -0
- package/dts/BigDecimal.d.ts.map +1 -0
- package/dts/BigInt.d.ts +30 -0
- package/dts/BigInt.d.ts.map +1 -0
- package/dts/DateTime.d.ts +1421 -0
- package/dts/DateTime.d.ts.map +1 -0
- package/dts/DateTimeFormat.d.ts +257 -0
- package/dts/DateTimeFormat.d.ts.map +1 -0
- package/dts/DateTimeFormatContext.d.ts +112 -0
- package/dts/DateTimeFormatContext.d.ts.map +1 -0
- package/dts/Email.d.ts +61 -0
- package/dts/Email.d.ts.map +1 -0
- package/dts/Integer.d.ts +123 -0
- package/dts/Integer.d.ts.map +1 -0
- package/dts/NumberBase10Format.d.ts +641 -0
- package/dts/NumberBase10Format.d.ts.map +1 -0
- package/dts/PositiveInteger.d.ts +161 -0
- package/dts/PositiveInteger.d.ts.map +1 -0
- package/dts/PositiveReal.d.ts +130 -0
- package/dts/PositiveReal.d.ts.map +1 -0
- package/dts/Real.d.ts +102 -0
- package/dts/Real.d.ts.map +1 -0
- package/dts/RoundingMode.d.ts +72 -0
- package/dts/RoundingMode.d.ts.map +1 -0
- package/dts/RoundingOption.d.ts +79 -0
- package/dts/RoundingOption.d.ts.map +1 -0
- package/dts/Schema.d.ts +159 -0
- package/dts/Schema.d.ts.map +1 -0
- package/dts/SemVer.d.ts +61 -0
- package/dts/SemVer.d.ts.map +1 -0
- package/dts/Template.d.ts +113 -0
- package/dts/Template.d.ts.map +1 -0
- package/dts/TemplatePart.d.ts +28 -0
- package/dts/TemplatePart.d.ts.map +1 -0
- package/dts/TemplateParts.d.ts +23 -0
- package/dts/TemplateParts.d.ts.map +1 -0
- package/dts/TemplatePlaceholder.d.ts +274 -0
- package/dts/TemplatePlaceholder.d.ts.map +1 -0
- package/dts/TemplateSeparator.d.ts +130 -0
- package/dts/TemplateSeparator.d.ts.map +1 -0
- package/dts/index.d.ts +21 -0
- package/dts/index.d.ts.map +1 -0
- package/dts/internal/Int.d.ts +6 -0
- package/dts/internal/Int.d.ts.map +1 -0
- package/dts/internal/Positive.d.ts +6 -0
- package/dts/internal/Positive.d.ts.map +1 -0
- package/esm/BigDecimal.js +9 -0
- package/esm/BigDecimal.js.map +1 -0
- package/esm/BigInt.js +27 -0
- package/esm/BigInt.js.map +1 -0
- package/esm/DateTime.js +2130 -0
- package/esm/DateTime.js.map +1 -0
- package/esm/DateTimeFormat.js +238 -0
- package/esm/DateTimeFormat.js.map +1 -0
- package/esm/DateTimeFormatContext.js +296 -0
- package/esm/DateTimeFormatContext.js.map +1 -0
- package/esm/Email.js +65 -0
- package/esm/Email.js.map +1 -0
- package/esm/Integer.js +128 -0
- package/esm/Integer.js.map +1 -0
- package/esm/NumberBase10Format.js +717 -0
- package/esm/NumberBase10Format.js.map +1 -0
- package/esm/PositiveInteger.js +164 -0
- package/esm/PositiveInteger.js.map +1 -0
- package/esm/PositiveReal.js +135 -0
- package/esm/PositiveReal.js.map +1 -0
- package/esm/Real.js +106 -0
- package/esm/Real.js.map +1 -0
- package/esm/RoundingMode.js +79 -0
- package/esm/RoundingMode.js.map +1 -0
- package/esm/RoundingOption.js +120 -0
- package/esm/RoundingOption.js.map +1 -0
- package/esm/Schema.js +203 -0
- package/esm/Schema.js.map +1 -0
- package/esm/SemVer.js +65 -0
- package/esm/SemVer.js.map +1 -0
- package/esm/Template.js +158 -0
- package/esm/Template.js.map +1 -0
- package/esm/TemplatePart.js +22 -0
- package/esm/TemplatePart.js.map +1 -0
- package/esm/TemplateParts.js +19 -0
- package/esm/TemplateParts.js.map +1 -0
- package/esm/TemplatePlaceholder.js +342 -0
- package/esm/TemplatePlaceholder.js.map +1 -0
- package/esm/TemplateSeparator.js +107 -0
- package/esm/TemplateSeparator.js.map +1 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/internal/Int.js +43 -0
- package/esm/internal/Int.js.map +1 -0
- package/esm/internal/Positive.js +43 -0
- package/esm/internal/Positive.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +49 -0
@@ -0,0 +1,1421 @@
|
|
1
|
+
/**
|
2
|
+
* This module implements an immutable DateTime object.
|
3
|
+
*
|
4
|
+
* DateTime objects keep an internal state. But all provided functions look pure insofar as they
|
5
|
+
* will always yield the same result whatever the state the object is in. The state is only used to
|
6
|
+
* improve performance but does not alter the results.
|
7
|
+
*
|
8
|
+
* Unlike the Javascript Date objects and the Effect DateTime objects, DateTime objects handle both
|
9
|
+
* the Gregorian and Iso calendars. So you can easily get/set the iso year and iso week of a
|
10
|
+
* DateTime object.
|
11
|
+
*
|
12
|
+
* A DateTime 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 DateTime object
|
14
|
+
* is `zoneOffset-dependent`, except `timestamp`. An important thing to note is that a DateTime
|
15
|
+
* object with a timestamp t and a zoneOffset zo has exactly the same date parts (year, ordinalDay,
|
16
|
+
* month, monthDay, isoYear...) as a DateTime object with a timestamp t+zox3600 and a 0 zoneOffset.
|
17
|
+
* That's the reason for the _zonedTimestamp field which is equal to t+zox3600. All calculations are
|
18
|
+
* performed UTC using _zonedTimestamp instead of timestamp.
|
19
|
+
*/
|
20
|
+
import { MInputError, MInspectable, MTypes } from '@parischap/effect-lib';
|
21
|
+
import { DateTime, Either, Equal, Equivalence, Inspectable, Option, Pipeable, Predicate } from 'effect';
|
22
|
+
/**
|
23
|
+
* Module tag
|
24
|
+
*
|
25
|
+
* @category Module markers
|
26
|
+
*/
|
27
|
+
export declare const moduleTag = "@parischap/conversions/DateTime/";
|
28
|
+
declare const _TypeId: unique symbol;
|
29
|
+
type _TypeId = typeof _TypeId;
|
30
|
+
/**
|
31
|
+
* Duration of a second in milliseconds
|
32
|
+
*
|
33
|
+
* @category Constants
|
34
|
+
*/
|
35
|
+
export declare const SECOND_MS = 1000;
|
36
|
+
/**
|
37
|
+
* Duration of a minute in milliseconds
|
38
|
+
*
|
39
|
+
* @category Constants
|
40
|
+
*/
|
41
|
+
export declare const MINUTE_MS: number;
|
42
|
+
/**
|
43
|
+
* Duration of an hour in milliseconds
|
44
|
+
*
|
45
|
+
* @category Constants
|
46
|
+
*/
|
47
|
+
export declare const HOUR_MS: number;
|
48
|
+
/**
|
49
|
+
* Duration of a day in milliseconds
|
50
|
+
*
|
51
|
+
* @category Constants
|
52
|
+
*/
|
53
|
+
export declare const DAY_MS: number;
|
54
|
+
/**
|
55
|
+
* Duration of a week in milliseconds
|
56
|
+
*
|
57
|
+
* @category Constants
|
58
|
+
*/
|
59
|
+
export declare const WEEK_MS: number;
|
60
|
+
/**
|
61
|
+
* Duration of a normal year in milliseconds
|
62
|
+
*
|
63
|
+
* @category Constants
|
64
|
+
*/
|
65
|
+
export declare const COMMON_YEAR_MS: number;
|
66
|
+
/**
|
67
|
+
* Duration of a leap year in milliseconds
|
68
|
+
*
|
69
|
+
* @category Constants
|
70
|
+
*/
|
71
|
+
export declare const LEAP_YEAR_MS: number;
|
72
|
+
/**
|
73
|
+
* Duration of a short iso year in milliseconds
|
74
|
+
*
|
75
|
+
* @category Constants
|
76
|
+
*/
|
77
|
+
export declare const SHORT_YEAR_MS: number;
|
78
|
+
/**
|
79
|
+
* Duration of a long iso year in milliseconds
|
80
|
+
*
|
81
|
+
* @category Constants
|
82
|
+
*/
|
83
|
+
export declare const LONG_YEAR_MS: number;
|
84
|
+
/**
|
85
|
+
* Local time zone offset in hours of the machine on which this code runs. The value is calculated
|
86
|
+
* once at startup.
|
87
|
+
*
|
88
|
+
* @category Constants
|
89
|
+
*/
|
90
|
+
export declare const LOCAL_TIME_ZONE_OFFSET: number;
|
91
|
+
/**
|
92
|
+
* Maximal usable year (ECMA-262)
|
93
|
+
*
|
94
|
+
* @category Constants
|
95
|
+
*/
|
96
|
+
export declare const MAX_FULL_YEAR: number;
|
97
|
+
/**
|
98
|
+
* Minimal usable year (ECMA-262)
|
99
|
+
*
|
100
|
+
* @category Constants
|
101
|
+
*/
|
102
|
+
export declare const MIN_FULL_YEAR: number;
|
103
|
+
/**
|
104
|
+
* Maximal usable timestamp (ECMA-262)
|
105
|
+
*
|
106
|
+
* @category Constants
|
107
|
+
*/
|
108
|
+
export declare const MAX_TIMESTAMP = 8640000000000000;
|
109
|
+
/**
|
110
|
+
* Minimal usable timestamp (ECMA-262)
|
111
|
+
*
|
112
|
+
* @category Constants
|
113
|
+
*/
|
114
|
+
export declare const MIN_TIMESTAMP: number;
|
115
|
+
/**
|
116
|
+
* Namespace for the a Gregorian date
|
117
|
+
*
|
118
|
+
* It is important to note that the Gregorian calendar is periodic with a 400-year period as far as
|
119
|
+
* leap years are concerned. Leap years are those that can be divided by 4, except those that can be
|
120
|
+
* divided by 100 except those that can be divided by 400. So 2100, 2200, 2300 are not leap years.
|
121
|
+
* But 2400 is a leap year.
|
122
|
+
*
|
123
|
+
* @category Models
|
124
|
+
*/
|
125
|
+
declare namespace GregorianDate {
|
126
|
+
const _TypeId: unique symbol;
|
127
|
+
type _TypeId = typeof _TypeId;
|
128
|
+
/**
|
129
|
+
* Type of a GregorianDate
|
130
|
+
*
|
131
|
+
* @category Models
|
132
|
+
*/
|
133
|
+
export interface Type extends Inspectable.Inspectable, Pipeable.Pipeable {
|
134
|
+
/** Timestamp of any moment in the day represented by this GregorianDate */
|
135
|
+
readonly timestamp: number;
|
136
|
+
/** The year of this GregorianDate , range: [MIN_FULL_YEAR, MAX_FULL_YEAR] */
|
137
|
+
readonly year: number;
|
138
|
+
/** `true` if `year` is a leap year. `false` otherwise */
|
139
|
+
readonly yearIsLeap: boolean;
|
140
|
+
/** Timestamp of the first millisecond of UTC `year` */
|
141
|
+
readonly yearStartTimestamp: number;
|
142
|
+
/** Position in the year of the day of this GregorianDate, range:[1, 366] */
|
143
|
+
readonly ordinalDay: number;
|
144
|
+
/** Month of this GregorianDate, range:[1, 12] */
|
145
|
+
readonly month: Option.Option<number>;
|
146
|
+
/** Position in the month of the day of this GregorianDate, range:[1, 31] */
|
147
|
+
readonly monthDay: Option.Option<number>;
|
148
|
+
readonly [_TypeId]: _TypeId;
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* Type guard
|
152
|
+
*
|
153
|
+
* @category Guards
|
154
|
+
*/
|
155
|
+
export const has: (u: unknown) => u is Type;
|
156
|
+
/**
|
157
|
+
* Constructs a GregorianDate from a timestamp
|
158
|
+
*
|
159
|
+
* @category Constructors
|
160
|
+
*/
|
161
|
+
export const fromTimestamp: (timestamp: number) => Type;
|
162
|
+
/**
|
163
|
+
* If possible, returns a new GregorianDate having `year` set to `year` and the same `month` and
|
164
|
+
* `monthDay` as `self`. Returns a left of an error otherwise. `year` must be an integer comprised
|
165
|
+
* in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. If `self` represents a 29th of february, `year`
|
166
|
+
* must be a leap year.
|
167
|
+
*
|
168
|
+
* @category Setters
|
169
|
+
*/
|
170
|
+
export const setYear: (year: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
171
|
+
/**
|
172
|
+
* If possible, returns a new GregorianDate having `month` set to `month` and the same `year` and
|
173
|
+
* `monthDay` as `self`. Returns a left of an error otherwise. `month` must be an integer greater
|
174
|
+
* than or equal to 1 (January) and less than or equal to 12 (December). `month` must also have at
|
175
|
+
* least `monthDay` days.
|
176
|
+
*
|
177
|
+
* @category Setters
|
178
|
+
*/
|
179
|
+
export const setMonth: (month: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
180
|
+
/**
|
181
|
+
* If possible, returns a new GregorianDate having `monthDay` set to `monthDay` and the same
|
182
|
+
* `year` and `month` as `self`. Returns a left of an error otherwise. `monthDay` must be an
|
183
|
+
* integer greater than or equal to 1 and less than or equal to the number of days in the current
|
184
|
+
* month.
|
185
|
+
*
|
186
|
+
* @category Setters
|
187
|
+
*/
|
188
|
+
export const setMonthDay: (monthDay: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
189
|
+
/**
|
190
|
+
* If possible, returns a new GregorianDate having `ordinalDay` set to `ordinalDay` and the same
|
191
|
+
* `year` as `self`. Returns a left of an error otherwise. `ordinalDay` must be an integer greater
|
192
|
+
* than or equal to 1 and less than or equal to the number of days in the current year
|
193
|
+
*
|
194
|
+
* @category Setters
|
195
|
+
*/
|
196
|
+
export const setOrdinalDay: (ordinalDay: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
197
|
+
/**
|
198
|
+
* Returns the `timestamp` property of `self`
|
199
|
+
*
|
200
|
+
* @category Destructors
|
201
|
+
*/
|
202
|
+
export const timestamp: MTypes.OneArgFunction<Type, number>;
|
203
|
+
/**
|
204
|
+
* Returns the `year` property of `self`
|
205
|
+
*
|
206
|
+
* @category Destructors
|
207
|
+
*/
|
208
|
+
export const year: MTypes.OneArgFunction<Type, number>;
|
209
|
+
/**
|
210
|
+
* Returns the `yearIsLeap` property of `self`
|
211
|
+
*
|
212
|
+
* @category Destructors
|
213
|
+
*/
|
214
|
+
export const yearIsLeap: Predicate.Predicate<Type>;
|
215
|
+
/**
|
216
|
+
* Returns the `yearStartTimestamp` property of `self`
|
217
|
+
*
|
218
|
+
* @category Destructors
|
219
|
+
*/
|
220
|
+
export const yearStartTimestamp: MTypes.OneArgFunction<Type, number>;
|
221
|
+
/**
|
222
|
+
* Returns the `ordinalDay` property of `self`
|
223
|
+
*
|
224
|
+
* @category Destructors
|
225
|
+
*/
|
226
|
+
export const ordinalDay: MTypes.OneArgFunction<Type, number>;
|
227
|
+
/**
|
228
|
+
* Returns the `month` of `self`
|
229
|
+
*
|
230
|
+
* @category Destructors
|
231
|
+
*/
|
232
|
+
export const getMonth: (self: Type) => number;
|
233
|
+
/**
|
234
|
+
* Returns the `monthDay` of `self`
|
235
|
+
*
|
236
|
+
* @category Destructors
|
237
|
+
*/
|
238
|
+
export const getMonthDay: (self: Type) => number;
|
239
|
+
/**
|
240
|
+
* Returns the duration of the year described by `self` in milliseconds
|
241
|
+
*
|
242
|
+
* @category Destructors
|
243
|
+
*/
|
244
|
+
export const getYearDurationInMs: (self: Type) => number;
|
245
|
+
/**
|
246
|
+
* Returns the duration of the year described by `self` in days
|
247
|
+
*
|
248
|
+
* @category Destructors
|
249
|
+
*/
|
250
|
+
export const getYearDurationInDays: (self: Type) => number;
|
251
|
+
/**
|
252
|
+
* Returns the number of days from the start of the `year` property of `self` to the day before
|
253
|
+
* the first day of month `month`
|
254
|
+
*
|
255
|
+
* @category Destructors
|
256
|
+
*/
|
257
|
+
export const getMonthOffset: (month: number) => (self: Type) => number;
|
258
|
+
/**
|
259
|
+
* Returns the number of days of month `month` of the `year` property of `self`
|
260
|
+
*
|
261
|
+
* @category Destructors
|
262
|
+
*/
|
263
|
+
export const getNumberOfDaysInMonth: (month: number) => MTypes.OneArgFunction<Type, number>;
|
264
|
+
/**
|
265
|
+
* Returns the ISO representation of this Gregorian Date
|
266
|
+
*
|
267
|
+
* @category Destructors
|
268
|
+
*/
|
269
|
+
export const getIsoString: MTypes.OneArgFunction<Type, string>;
|
270
|
+
export {};
|
271
|
+
}
|
272
|
+
/**
|
273
|
+
* Namespace for an IsoDate.
|
274
|
+
*
|
275
|
+
* An iso year starts on the first day of the first iso week. An iso week starts on a monday and
|
276
|
+
* ends on a sunday. The first iso week of the year is the one that contains January 4th (see
|
277
|
+
* Wikipedia).
|
278
|
+
*
|
279
|
+
* @category Models
|
280
|
+
*/
|
281
|
+
declare namespace IsoDate {
|
282
|
+
/**
|
283
|
+
* Type of an IsoYearDescriptor
|
284
|
+
*
|
285
|
+
* @category Models
|
286
|
+
*/
|
287
|
+
interface Type extends Inspectable.Inspectable, Pipeable.Pipeable {
|
288
|
+
/** Timestamp of any moment of the day represented by this IsoDate */
|
289
|
+
readonly timestamp: number;
|
290
|
+
/** The iso year of this IsoDate, range: [MIN_FULL_YEAR, MAX_FULL_YEAR] */
|
291
|
+
readonly year: number;
|
292
|
+
/** If true, iso year `year` counts 53 weeks. Otherwise, it counts 52 weeks */
|
293
|
+
readonly yearIsLong: boolean;
|
294
|
+
/** Timestamp of the first millisecond of UTC iso year `year` */
|
295
|
+
readonly yearStartTimestamp: number;
|
296
|
+
/** The iso week of this IsoYear, range:[1, 53] */
|
297
|
+
readonly isoWeek: Option.Option<number>;
|
298
|
+
/** The weekday of this DateTime, range:[1, 7], 1 is monday, 7 is sunday */
|
299
|
+
readonly weekday: Option.Option<number>;
|
300
|
+
}
|
301
|
+
/**
|
302
|
+
* Type guard
|
303
|
+
*
|
304
|
+
* @category Guards
|
305
|
+
*/
|
306
|
+
const has: (u: unknown) => u is Type;
|
307
|
+
/**
|
308
|
+
* Constructs an IsoDate from a timestamp
|
309
|
+
*
|
310
|
+
* @category Constructors
|
311
|
+
*/
|
312
|
+
const fromTimestamp: (timestamp: number) => Type;
|
313
|
+
/**
|
314
|
+
* Constructs an IsoDate from a GregorianDate
|
315
|
+
*
|
316
|
+
* @category Constructors
|
317
|
+
*/
|
318
|
+
const fromGregorianDate: (gregorianDate: GregorianDate.Type) => Type;
|
319
|
+
/**
|
320
|
+
* If possible, returns a new IsoDate having `year` set to `year` and the same `isoWeek` and
|
321
|
+
* `weekday` as `self`. Returns a left of an error otherwise. `year` must be an integer comprised
|
322
|
+
* in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. If the isoWeek of `self` is equal to 53, `year`
|
323
|
+
* must be a long year.
|
324
|
+
*
|
325
|
+
* @category Setters
|
326
|
+
*/
|
327
|
+
const setYear: (year: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
328
|
+
/**
|
329
|
+
* If possible, returns a new IsoDate having `isoWeek` set to `isoWeek` and the same `year` and
|
330
|
+
* `weekday` as `self`. Returns a left of an error otherwise. `isoWeek` must be an integer greater
|
331
|
+
* than or equal to 1 and less than or equal to the number of iso weeks in the current year.
|
332
|
+
*
|
333
|
+
* @category Setters
|
334
|
+
*/
|
335
|
+
const setIsoWeek: (isoWeek: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
336
|
+
/**
|
337
|
+
* If possible, returns a new IsoDate having `weekday` set to `weekday` and the same `year` and
|
338
|
+
* `isoWeek` as `self`. Returns a left of an error otherwise. `weekday` must be an integer greater
|
339
|
+
* than or equal to 1 (monday) and less than or equal to 7 (sunday).
|
340
|
+
*
|
341
|
+
* @category Setters
|
342
|
+
*/
|
343
|
+
const setWeekday: (weekday: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
344
|
+
/**
|
345
|
+
* Returns the `timestamp` property of `self`
|
346
|
+
*
|
347
|
+
* @category Destructors
|
348
|
+
*/
|
349
|
+
const timestamp: MTypes.OneArgFunction<Type, number>;
|
350
|
+
/**
|
351
|
+
* Returns the `year` property of `self`
|
352
|
+
*
|
353
|
+
* @category Destructors
|
354
|
+
*/
|
355
|
+
const year: MTypes.OneArgFunction<Type, number>;
|
356
|
+
/**
|
357
|
+
* Returns the `yearStartTimestamp` property of `self`
|
358
|
+
*
|
359
|
+
* @category Destructors
|
360
|
+
*/
|
361
|
+
const yearStartTimestamp: MTypes.OneArgFunction<Type, number>;
|
362
|
+
/**
|
363
|
+
* Returns the `yearIsLong` property of `self`
|
364
|
+
*
|
365
|
+
* @category Destructors
|
366
|
+
*/
|
367
|
+
const yearIsLong: Predicate.Predicate<Type>;
|
368
|
+
/**
|
369
|
+
* Returns the `isoWeek` of `self`
|
370
|
+
*
|
371
|
+
* @category Destructors
|
372
|
+
*/
|
373
|
+
const getIsoWeek: (self: Type) => number;
|
374
|
+
/**
|
375
|
+
* Returns the `weekday` of `self`
|
376
|
+
*
|
377
|
+
* @category Destructors
|
378
|
+
*/
|
379
|
+
const getWeekday: (self: Type) => number;
|
380
|
+
/**
|
381
|
+
* Returns the duration of the year described by `self` in milliseconds
|
382
|
+
*
|
383
|
+
* @category Destructors
|
384
|
+
*/
|
385
|
+
const getMsDuration: (self: Type) => number;
|
386
|
+
/**
|
387
|
+
* Returns the duration of the year described by `self` in milliseconds
|
388
|
+
*
|
389
|
+
* @category Destructors
|
390
|
+
*/
|
391
|
+
const getLastIsoWeek: (self: Type) => number;
|
392
|
+
/**
|
393
|
+
* Returns the ISO representation of this Gregorian Date
|
394
|
+
*
|
395
|
+
* @category Destructors
|
396
|
+
*/
|
397
|
+
const getIsoString: MTypes.OneArgFunction<Type, string>;
|
398
|
+
}
|
399
|
+
/**
|
400
|
+
* Namespace for the data relative to the time
|
401
|
+
*
|
402
|
+
* @category Models
|
403
|
+
*/
|
404
|
+
declare namespace Time {
|
405
|
+
/**
|
406
|
+
* Type of a Time
|
407
|
+
*
|
408
|
+
* @category Models
|
409
|
+
*/
|
410
|
+
interface Type extends Inspectable.Inspectable, Pipeable.Pipeable {
|
411
|
+
/** This Time expressed in milliseconds, range:[0, DAY_MS[ */
|
412
|
+
readonly timestampOffset: number;
|
413
|
+
/** Hour23 of this Time, range:[0, 23] */
|
414
|
+
readonly hour23: number;
|
415
|
+
/** Hour11 of this Time, range:[0, 11] */
|
416
|
+
readonly hour11: number;
|
417
|
+
/** Meridiem of this Time, 0 for 'AM', 12 for 'PM' */
|
418
|
+
readonly meridiem: 0 | 12;
|
419
|
+
/** Minute of this Time, range:[0, 59] */
|
420
|
+
readonly minute: number;
|
421
|
+
/** Second of this Time, range:[0, 59] */
|
422
|
+
readonly second: number;
|
423
|
+
/** Millisecond of this Time, range:[0, 999] */
|
424
|
+
readonly millisecond: number;
|
425
|
+
}
|
426
|
+
/**
|
427
|
+
* Type guard
|
428
|
+
*
|
429
|
+
* @category Guards
|
430
|
+
*/
|
431
|
+
const has: (u: unknown) => u is Type;
|
432
|
+
/**
|
433
|
+
* Constructs the Time that corresponds to the passed `timestampOffset` which is the number of
|
434
|
+
* milliseconds from the start of the current day
|
435
|
+
*
|
436
|
+
* @category Constructors
|
437
|
+
*/
|
438
|
+
const fromTimestamp: (timestampOffset: number) => Type;
|
439
|
+
/**
|
440
|
+
* If possible, returns a right of a copy of `self` with `hour23` set to `hour23`. Returns a left
|
441
|
+
* of an error otherwise. `hour23` must be an integer greater than or equal to 0 and less than or
|
442
|
+
* equal to 23
|
443
|
+
*
|
444
|
+
* @category Setters
|
445
|
+
*/
|
446
|
+
const setHour23: (hour23: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
447
|
+
/**
|
448
|
+
* If possible, returns a right of a copy of `self` with `hour11` set to `hour11`. Returns a left
|
449
|
+
* of an error otherwise. `hour11` must be an integer greater than or equal to 0 and less than or
|
450
|
+
* equal to 11
|
451
|
+
*
|
452
|
+
* @category Setters
|
453
|
+
*/
|
454
|
+
const setHour11: (hour11: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
455
|
+
/**
|
456
|
+
* Returns a copy of `self` with `meridiem` set to `merdiem`.
|
457
|
+
*
|
458
|
+
* @category Setters
|
459
|
+
*/
|
460
|
+
const setMeridiem: (meridiem: 0 | 12) => (self: Type) => Type;
|
461
|
+
/**
|
462
|
+
* If possible, returns a right of a copy of `self` with `minute` set to `minute`. Returns a left
|
463
|
+
* of an error otherwise. `minute` must be an integer greater than or equal to 0 and less than or
|
464
|
+
* equal to 59
|
465
|
+
*
|
466
|
+
* @category Setters
|
467
|
+
*/
|
468
|
+
const setMinute: (minute: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
469
|
+
/**
|
470
|
+
* If possible, returns a right of a copy of `self` with `second` set to `second`. Returns a left
|
471
|
+
* of an error otherwise. `second` must be an integer greater than or equal to 0 and less than or
|
472
|
+
* equal to 59
|
473
|
+
*
|
474
|
+
* @category Setters
|
475
|
+
*/
|
476
|
+
const setSecond: (second: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
477
|
+
/**
|
478
|
+
* If possible, returns a right of a copy of `self` with `millisecond` set to `millisecond`.
|
479
|
+
* Returns a left of an error otherwise. `millisecond` must be an integer greater than or equal to
|
480
|
+
* 0 and less than or equal to 999
|
481
|
+
*
|
482
|
+
* @category Setters
|
483
|
+
*/
|
484
|
+
const setMillisecond: (millisecond: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
485
|
+
/**
|
486
|
+
* Returns the `timestampOffset` property of `self`
|
487
|
+
*
|
488
|
+
* @category Destructors
|
489
|
+
*/
|
490
|
+
const timestampOffset: MTypes.OneArgFunction<Type, number>;
|
491
|
+
/**
|
492
|
+
* Returns the `hour23` property of `self`
|
493
|
+
*
|
494
|
+
* @category Destructors
|
495
|
+
*/
|
496
|
+
const hour23: MTypes.OneArgFunction<Type, number>;
|
497
|
+
/**
|
498
|
+
* Returns the `hour11` property of `self`
|
499
|
+
*
|
500
|
+
* @category Destructors
|
501
|
+
*/
|
502
|
+
const hour11: MTypes.OneArgFunction<Type, number>;
|
503
|
+
/**
|
504
|
+
* Returns the `meridiem` property of `self`
|
505
|
+
*
|
506
|
+
* @category Destructors
|
507
|
+
*/
|
508
|
+
const meridiem: MTypes.OneArgFunction<Type, 0 | 12>;
|
509
|
+
/**
|
510
|
+
* Returns the `minute` property of `self`
|
511
|
+
*
|
512
|
+
* @category Destructors
|
513
|
+
*/
|
514
|
+
const minute: MTypes.OneArgFunction<Type, number>;
|
515
|
+
/**
|
516
|
+
* Returns the `second` property of `self`
|
517
|
+
*
|
518
|
+
* @category Destructors
|
519
|
+
*/
|
520
|
+
const second: MTypes.OneArgFunction<Type, number>;
|
521
|
+
/**
|
522
|
+
* Returns the `millisecond` property of `self`
|
523
|
+
*
|
524
|
+
* @category Destructors
|
525
|
+
*/
|
526
|
+
const millisecond: MTypes.OneArgFunction<Type, number>;
|
527
|
+
/**
|
528
|
+
* Returns the ISO representation of this Gregorian Date
|
529
|
+
*
|
530
|
+
* @category Destructors
|
531
|
+
*/
|
532
|
+
const getIsoString: MTypes.OneArgFunction<Type, string>;
|
533
|
+
}
|
534
|
+
/**
|
535
|
+
* Namespace for the data relative to the parts of a zone offset
|
536
|
+
*
|
537
|
+
* @category Models
|
538
|
+
*/
|
539
|
+
declare namespace ZoneOffsetParts {
|
540
|
+
/**
|
541
|
+
* Type of a ZoneOffsetParts. Note that ZoneOffsetParts with hour=-0, minute=10, second=0 is
|
542
|
+
* different from hour=0, minute=10, second=0. The first corresponds to the string 'GMT-00:10', a
|
543
|
+
* negative 10-minute offset, the second one to the string 'GMT+00:10', a positive 10-minute
|
544
|
+
* offset.
|
545
|
+
*
|
546
|
+
* @category Models
|
547
|
+
*/
|
548
|
+
interface Type extends Inspectable.Inspectable, Pipeable.Pipeable {
|
549
|
+
/** Hour part, range: [-12,14] */
|
550
|
+
readonly zoneHour: number;
|
551
|
+
/** Minute part, range: [0, 59] */
|
552
|
+
readonly zoneMinute: number;
|
553
|
+
/** Second part, range: [0, 59] */
|
554
|
+
readonly zoneSecond: number;
|
555
|
+
}
|
556
|
+
/**
|
557
|
+
* Type guard
|
558
|
+
*
|
559
|
+
* @category Guards
|
560
|
+
*/
|
561
|
+
const has: (u: unknown) => u is Type;
|
562
|
+
const _make: (params: MTypes.Data<Type>) => Type;
|
563
|
+
/**
|
564
|
+
* Builds a ZoneOffsetParts from `zoneOffset`
|
565
|
+
*
|
566
|
+
* @category Constructors
|
567
|
+
*/
|
568
|
+
const fromZoneOffset: (zoneOffset: number) => Type;
|
569
|
+
/**
|
570
|
+
* Tries to build a ZoneOffsetParts from `zoneHour`, `zoneMinute`, `zoneSecond`. Returns a `some`
|
571
|
+
* if successful. A `none` otherwise.
|
572
|
+
*
|
573
|
+
* - `zoneHour` must be greater than or equal to -12 and less than or equal to 14.
|
574
|
+
* - `zoneMinute` must be greater than or equal to 0 and less than or equal to 59.
|
575
|
+
* - `zoneSecond` must be greater than or equal to 0 and less than or equal to 59.
|
576
|
+
*
|
577
|
+
* @category Constructors
|
578
|
+
*/
|
579
|
+
const fromParts: ({ zoneHour, zoneMinute, zoneSecond }: {
|
580
|
+
readonly zoneHour: number;
|
581
|
+
readonly zoneMinute: number;
|
582
|
+
readonly zoneSecond: number;
|
583
|
+
}) => Either.Either<Type, MInputError.Type>;
|
584
|
+
/**
|
585
|
+
* Returns the `zoneHour` property of `self`
|
586
|
+
*
|
587
|
+
* @category Destructors
|
588
|
+
*/
|
589
|
+
const zoneHour: MTypes.OneArgFunction<Type, number>;
|
590
|
+
/**
|
591
|
+
* Returns the `zoneMinute` property of `self`
|
592
|
+
*
|
593
|
+
* @category Destructors
|
594
|
+
*/
|
595
|
+
const zoneMinute: MTypes.OneArgFunction<Type, number>;
|
596
|
+
/**
|
597
|
+
* Returns the `zoneSecond` property of `self`
|
598
|
+
*
|
599
|
+
* @category Destructors
|
600
|
+
*/
|
601
|
+
const zoneSecond: MTypes.OneArgFunction<Type, number>;
|
602
|
+
/**
|
603
|
+
* Returns the ISO representation of this Gregorian Date
|
604
|
+
*
|
605
|
+
* @category Destructors
|
606
|
+
*/
|
607
|
+
const getIsoString: MTypes.OneArgFunction<Type, string>;
|
608
|
+
/**
|
609
|
+
* Returns the value of `self` expressed in hours
|
610
|
+
*
|
611
|
+
* @category Destructors
|
612
|
+
*/
|
613
|
+
const toHour: (self: Type) => number;
|
614
|
+
}
|
615
|
+
/**
|
616
|
+
* Type of a DateTime
|
617
|
+
*
|
618
|
+
* @category Models
|
619
|
+
*/
|
620
|
+
export interface Type extends Equal.Equal, MInspectable.Type, Pipeable.Pipeable {
|
621
|
+
/** Timestamp of this DateTime (timezone-independent) */
|
622
|
+
readonly timestamp: number;
|
623
|
+
/** GregorianDate of this DateTime, expressed in given timezone */
|
624
|
+
readonly gregorianDate: Option.Option<GregorianDate.Type>;
|
625
|
+
/** IsoDate of this DateTime, expressed in given timezone */
|
626
|
+
readonly isoDate: Option.Option<IsoDate.Type>;
|
627
|
+
/** Time of this DateTime, expressed in given timezone */
|
628
|
+
readonly time: Option.Option<Time.Type>;
|
629
|
+
/**
|
630
|
+
* Offset in hours between the time of the zone for which all calculations of that DateTime object
|
631
|
+
* will be carried out and UTC time (e.g zoneOffset=1 for timezone +1:00). Not necessarily an
|
632
|
+
* integer, range: ]-13, 15[
|
633
|
+
*/
|
634
|
+
readonly zoneOffset: number;
|
635
|
+
/** ZoneOffset decomposed into its parts */
|
636
|
+
readonly zoneOffsetParts: Option.Option<ZoneOffsetParts.Type>;
|
637
|
+
readonly [_TypeId]: _TypeId;
|
638
|
+
}
|
639
|
+
/**
|
640
|
+
* Type guard
|
641
|
+
*
|
642
|
+
* @category Guards
|
643
|
+
*/
|
644
|
+
export declare const has: (u: unknown) => u is Type;
|
645
|
+
/**
|
646
|
+
* Equivalence
|
647
|
+
*
|
648
|
+
* @category Equivalences
|
649
|
+
*/
|
650
|
+
export declare const equivalence: Equivalence.Equivalence<Type>;
|
651
|
+
/**
|
652
|
+
* Returns the ISO representation of this DateTime
|
653
|
+
*
|
654
|
+
* @category Destructors
|
655
|
+
*/
|
656
|
+
export declare const getIsoString: (self: Type) => string;
|
657
|
+
/**
|
658
|
+
* Tries to build a DateTime from `timestamp`, the number of milliseconds since 1/1/1970
|
659
|
+
* 00:00:00:000+0:00, and `zoneOffset` which gives the offset between the local time and the UTC
|
660
|
+
* time. Returns a `right` of a DateTime if successful.
|
661
|
+
*
|
662
|
+
* `timestamp` must be greater than or equal to MIN_TIMESTAMP and less than or equal to
|
663
|
+
* MAX_TIMESTAMP.
|
664
|
+
*
|
665
|
+
* If `zoneOffset` is omitted, the local time zone offset of the machine this code is running on is
|
666
|
+
* used.
|
667
|
+
*
|
668
|
+
* `zoneOffset` can be expressed as as a number of hours. In this case, it must be strictly greater
|
669
|
+
* to -13 and strictly less than 15.
|
670
|
+
*
|
671
|
+
* It can also be expressed as an object containing three components:
|
672
|
+
*
|
673
|
+
* - `zoneHour` which must be greater than or equal to -12 and less than or equal to 14.
|
674
|
+
* - `zoneMinute` which must be greater than or equal to 0 and less than or equal to 59.
|
675
|
+
* - `zoneSecond` which must be greater than or equal to 0 and less than or equal to 59.
|
676
|
+
*
|
677
|
+
* Note that zoneHour=-0, zoneMinute=10, zoneSecond=0 is different from zoneHour=0, zoneMinute=10,
|
678
|
+
* zoneSecond=0. The first corresponds to the string 'GMT-00:10', a negative 10-minute offset, the
|
679
|
+
* second one to the string 'GMT+00:10', a positive 10-minute offset.
|
680
|
+
*
|
681
|
+
* `timestamp`, `zoneHour`, `zoneMinute` and `zoneSecond` should be integers. `zoneOffset`, when
|
682
|
+
* expressed as a number of hours, does not need to be an integer.
|
683
|
+
*
|
684
|
+
* @category Constructors
|
685
|
+
*/
|
686
|
+
export declare const fromTimestamp: (timestamp: number, zoneOffset?: number | {
|
687
|
+
readonly zoneHour: number;
|
688
|
+
readonly zoneMinute: number;
|
689
|
+
readonly zoneSecond: number;
|
690
|
+
}) => Either.Either<Type, MInputError.Type>;
|
691
|
+
/**
|
692
|
+
* Same as fromTimestamp but returns directly the DateTime or throws if it cannot be built
|
693
|
+
*
|
694
|
+
* @category Constructors
|
695
|
+
*/
|
696
|
+
export declare const fromTimestampOrThrow: (timestamp: number, zoneOffset?: number | {
|
697
|
+
readonly zoneHour: number;
|
698
|
+
readonly zoneMinute: number;
|
699
|
+
readonly zoneSecond: number;
|
700
|
+
}) => Type;
|
701
|
+
/**
|
702
|
+
* Builds a DateTime using Date.now() as timestamp. `zoneOffset` is set to 0.
|
703
|
+
*
|
704
|
+
* @category Constructors
|
705
|
+
*/
|
706
|
+
export declare const now: () => Type;
|
707
|
+
/**
|
708
|
+
* Namespace for the different parts of a date
|
709
|
+
*
|
710
|
+
* @category Models
|
711
|
+
*/
|
712
|
+
export declare namespace Parts {
|
713
|
+
/**
|
714
|
+
* Type of a Parts
|
715
|
+
*
|
716
|
+
* @category Models
|
717
|
+
*/
|
718
|
+
interface Type {
|
719
|
+
/** The Gregorian year, range: [MIN_FULL_YEAR, MAX_FULL_YEAR] */
|
720
|
+
readonly year?: number;
|
721
|
+
/** Number of days elapsed since the start of year, range:[1, 366] */
|
722
|
+
readonly ordinalDay?: number;
|
723
|
+
/** Month in the current year, range:[1, 12] */
|
724
|
+
readonly month?: number;
|
725
|
+
/** Day in the current month, range:[1, 12] */
|
726
|
+
readonly monthDay?: number;
|
727
|
+
/** The iso year, range: [MIN_FULL_YEAR, MAX_FULL_YEAR] */
|
728
|
+
readonly isoYear?: number;
|
729
|
+
/** The iso week in the current iso year, range:[1, 53] */
|
730
|
+
readonly isoWeek?: number;
|
731
|
+
/** Week day in the current iso week, range:[1, 7], 1 is monday, 7 is sunday */
|
732
|
+
readonly weekday?: number;
|
733
|
+
/** Number of hours since the start of the current day, range:[0, 23] */
|
734
|
+
readonly hour23?: number;
|
735
|
+
/** Number of hours since the start of the current meridiem, range:[0, 11] */
|
736
|
+
readonly hour11?: number;
|
737
|
+
/** Meridiem offset of this DateTime in hours, 0 for 'AM', 12 for 'PM' */
|
738
|
+
readonly meridiem?: 0 | 12;
|
739
|
+
/** Number of minutes since the start of the current hour, range:[0, 59] */
|
740
|
+
readonly minute?: number;
|
741
|
+
/** Number of seconds, since sthe start of the current minute, range:[0, 59] */
|
742
|
+
readonly second?: number;
|
743
|
+
/** Number of milliseconds, since sthe start of the current second, range:[0, 999] */
|
744
|
+
readonly millisecond?: number;
|
745
|
+
/**
|
746
|
+
* Offset in hours between the time in the local zone and UTC time (e.g zoneOffset=1 for
|
747
|
+
* timezone +1:00). Not necessarily an integer, range: ]-13, 15[
|
748
|
+
*/
|
749
|
+
readonly zoneOffset?: number;
|
750
|
+
/** Hour part of the zoneOffset. Should be an integer in the range: [-12, 14] */
|
751
|
+
readonly zoneHour?: number;
|
752
|
+
/** Minute part of the zoneOffset. Should be an integer in the range: [0, 59] */
|
753
|
+
readonly zoneMinute?: number;
|
754
|
+
/** Second part of the zoneOffset. Should be an integer in the range: [0, 59] */
|
755
|
+
readonly zoneSecond?: number;
|
756
|
+
}
|
757
|
+
}
|
758
|
+
/**
|
759
|
+
* Tries to build a DateTime from the provided DateTime parts. Returns a `right` of this DateTime if
|
760
|
+
* successful. Returns a `left` of an error otherwise.
|
761
|
+
*
|
762
|
+
* `year` must comprised in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. `ordinalDay` must be greater
|
763
|
+
* than or equal to 1 and less than or equal to the number of days in the current year. `month` must
|
764
|
+
* be greater than or equal to 1 (January) and less than or equal to 12 (December). `monthDay` must
|
765
|
+
* be greater than or equal to 1 and less than or equal to the number of days in the current month.
|
766
|
+
*
|
767
|
+
* `isoYear` must be comprised in the range [MIN_FULL_YEAR, MAX_FULL_YEAR]. `isoWeek` must be
|
768
|
+
* greater than or equal to 1 and less than or equal to the number of iso weeks in the current year.
|
769
|
+
* `weekday` must be greater than or equal to 1 (monday) and less than or equal to 7 (sunday).
|
770
|
+
*
|
771
|
+
* If there is not sufficient information to determine the exact day of the year, i.e. none of the
|
772
|
+
* three following tuples is fully determined [year, ordinalDay], [year, month, monthDay], [isoYear,
|
773
|
+
* isoWeek, weekday], default values are determined in the following order (the first match stops
|
774
|
+
* the process):
|
775
|
+
*
|
776
|
+
* - If `year` and `month` are set, `monthDay` is taken equal to 1.
|
777
|
+
* - If `year` and `monthDay` are set, `month` is taken equal to 1.
|
778
|
+
* - If `year` is set and both `month` and `monthDay` are undefined, the day is taken to be the first
|
779
|
+
* one in the year.
|
780
|
+
* - If `isoYear` and `isoWeek` are set, `weekday` is taken equal to 1.
|
781
|
+
* - If `isoYear` and `weekday` are set, `isoWeek` is taken equal to 1.
|
782
|
+
* - If `isoYear` is set and both `isoWeek` and `weekday` are undefined, the day is taken to be the
|
783
|
+
* first one in the iso year.
|
784
|
+
* - If both `year` and `isoYear` are undefined, an error is raised.
|
785
|
+
*
|
786
|
+
* `hour23` must be greater than or equal to 0 and less than or equal to 23. `hour11` must be
|
787
|
+
* greater than or equal to 0 and less than or equal to 11. `meridiem` must be one of 0 (AM) or 12
|
788
|
+
* (PM). If there is not sufficient information to determine the hour of the day, i.e. none of the
|
789
|
+
* two following tuples is fully determined [hour23], [hour11, meridiem], default values are
|
790
|
+
* determined as follows:
|
791
|
+
*
|
792
|
+
* - If `meridiem` is set, `hour11` is taken equal to 0.
|
793
|
+
* - If `hour11` is set, `meridiem` is taken equal to 0.
|
794
|
+
* - Otherwise, `meridiem` and `hour11` are taken equal to 0.
|
795
|
+
*
|
796
|
+
* `minute` must be greater than or equal to 0 and less than or equal to 59. If omitted, minute is
|
797
|
+
* assumed to be 0.
|
798
|
+
*
|
799
|
+
* `second` must be greater than or equal to 0 and less than or equal to 59. If omitted, second is
|
800
|
+
* assumed to be 0.
|
801
|
+
*
|
802
|
+
* `millisecond` must be greater than or equal to 0 and less than or equal to 999. If omitted,
|
803
|
+
* millisecond is assumed to be 0.
|
804
|
+
*
|
805
|
+
* `zoneOffset` must be strictly greater to -13 and strictly less than 15. `zoneHour` must be
|
806
|
+
* greater than or equal to -12 and less than or equal to 14. `zoneMinute` must be greater than or
|
807
|
+
* equal to 0 and less than or equal to 59. `zoneSecond` must be greater than or equal to 0 and less
|
808
|
+
* than or equal to 59.
|
809
|
+
*
|
810
|
+
* If there is not sufficient information to determine the exact time zone offset, i.e. none of the
|
811
|
+
* two following tuples is fully determined [zoneOffset], [zoneHour, zoneMinute, zoneSecond],
|
812
|
+
* default values are determined as follows :
|
813
|
+
*
|
814
|
+
* - If all parameters are undefined, the local time zone offset of the machine this code is running
|
815
|
+
* on is used.
|
816
|
+
* - If any of `zoneHour`, `zoneMinute`, `zoneSecond`, the undefined parameters are taken equal to 0.
|
817
|
+
*
|
818
|
+
* Note that zoneHour=-0, zoneMinute=10, zoneSecond=0 is different from zoneHour=0, zoneMinute=10,
|
819
|
+
* zoneSecond=0. The first corresponds to the string 'GMT-00:10', a negative 10-minute offset, the
|
820
|
+
* second one to the string 'GMT+00:10', a positive 10-minute offset.
|
821
|
+
*
|
822
|
+
* `year`, `ordinalDay`, `month`, `monthDay`, `isoYear`, `isoWeek`, `weekDay`, `hour23`, `hour11`,
|
823
|
+
* `minute`, `second`, `millisecond`, `zoneHour`, `zoneMinute` and `zoneSecond` should be integers.
|
824
|
+
* `zoneOffset` does not need to be an integer.
|
825
|
+
*
|
826
|
+
* All parameters must be coherent. For instance, `year=1970`, `month=1`, `monthDay=1`, `weekday=0`
|
827
|
+
* `zoneHour=0`, `zoneMinute=0` and `zoneSecond=0` will trigger an error because 1/1/1970
|
828
|
+
* 00:00:00:000+0:00 is a thursday. `hour23=13` and `meridiem=0` will also trigger an error.
|
829
|
+
*
|
830
|
+
* @category Constructors
|
831
|
+
*/
|
832
|
+
export declare const fromParts: ({ year, ordinalDay, month, monthDay, isoYear, isoWeek, weekday, hour23, hour11, meridiem, minute, second, millisecond, zoneOffset, zoneHour, zoneMinute, zoneSecond }: Parts.Type) => Either.Either<Type, MInputError.Type>;
|
833
|
+
/**
|
834
|
+
* Same as fromParts but returns directly the DateTime or throws if it cannot be built
|
835
|
+
*
|
836
|
+
* @category Constructors
|
837
|
+
*/
|
838
|
+
export declare const fromPartsOrThrow: (parts: Parts.Type) => Type;
|
839
|
+
/**
|
840
|
+
* Builds a CVDateTime from a Javascript Date
|
841
|
+
*
|
842
|
+
* @category Constructors
|
843
|
+
*/
|
844
|
+
export declare const fromDate: (date: Date) => Type;
|
845
|
+
/**
|
846
|
+
* Builds a CVDateTime from an Effect DateTime
|
847
|
+
*
|
848
|
+
* @category Constructors
|
849
|
+
*/
|
850
|
+
export declare const fromEffectDateTime: (date: DateTime.Zoned) => Type;
|
851
|
+
/**
|
852
|
+
* Builds a Javascript Date from a CVDateTime
|
853
|
+
*
|
854
|
+
* @category Conversions
|
855
|
+
*/
|
856
|
+
export declare const toDate: (self: Type) => Date;
|
857
|
+
/**
|
858
|
+
* Builds an Effect DateTime from a CVDateTime
|
859
|
+
*
|
860
|
+
* @category Conversions
|
861
|
+
*/
|
862
|
+
export declare const toEffectDateTime: (self: Type) => DateTime.Zoned;
|
863
|
+
/**
|
864
|
+
* Returns the timestamp of `self` as a number
|
865
|
+
*
|
866
|
+
* @category Getters
|
867
|
+
*/
|
868
|
+
export declare const timestamp: MTypes.OneArgFunction<Type, number>;
|
869
|
+
/**
|
870
|
+
* Returns the (Gregorian) year of `self` for the given time zone
|
871
|
+
*
|
872
|
+
* @category Getters
|
873
|
+
*/
|
874
|
+
export declare const getYear: MTypes.OneArgFunction<Type, number>;
|
875
|
+
/**
|
876
|
+
* Returns true if the (Gregorian) year of `self` for the given time zone is a leap year. Returns
|
877
|
+
* false otherwise
|
878
|
+
*
|
879
|
+
* @category Getters
|
880
|
+
*/
|
881
|
+
export declare const yearIsLeap: MTypes.OneArgFunction<Type, boolean>;
|
882
|
+
/**
|
883
|
+
* Returns the ordinalDay of `self` for the given time zone
|
884
|
+
*
|
885
|
+
* @category Getters
|
886
|
+
*/
|
887
|
+
export declare const getOrdinalDay: MTypes.OneArgFunction<Type, number>;
|
888
|
+
/**
|
889
|
+
* Returns the month of `self` for the given time zone
|
890
|
+
*
|
891
|
+
* @category Getters
|
892
|
+
*/
|
893
|
+
export declare const getMonth: MTypes.OneArgFunction<Type, number>;
|
894
|
+
/**
|
895
|
+
* Returns the monthDay of `self` for the given time zone
|
896
|
+
*
|
897
|
+
* @category Getters
|
898
|
+
*/
|
899
|
+
export declare const getMonthDay: MTypes.OneArgFunction<Type, number>;
|
900
|
+
/**
|
901
|
+
* Returns the isoYear of `self` for the given time zone
|
902
|
+
*
|
903
|
+
* @category Getters
|
904
|
+
*/
|
905
|
+
export declare const getIsoYear: MTypes.OneArgFunction<Type, number>;
|
906
|
+
/**
|
907
|
+
* Returns true if the isoYear of `self` for the given time zone is a long year. Returns false
|
908
|
+
* otherwise
|
909
|
+
*
|
910
|
+
* @category Getters
|
911
|
+
*/
|
912
|
+
export declare const isoYearIsLong: MTypes.OneArgFunction<Type, boolean>;
|
913
|
+
/**
|
914
|
+
* Returns the isoWeek of `self` for the given time zone
|
915
|
+
*
|
916
|
+
* @category Getters
|
917
|
+
*/
|
918
|
+
export declare const getIsoWeek: MTypes.OneArgFunction<Type, number>;
|
919
|
+
/**
|
920
|
+
* Returns the weekday of `self` for the given time zone
|
921
|
+
*
|
922
|
+
* @category Getters
|
923
|
+
*/
|
924
|
+
export declare const getWeekday: MTypes.OneArgFunction<Type, number>;
|
925
|
+
/**
|
926
|
+
* Returns the hour23 of `self` for the given time zone
|
927
|
+
*
|
928
|
+
* @category Getters
|
929
|
+
*/
|
930
|
+
export declare const getHour23: MTypes.OneArgFunction<Type, number>;
|
931
|
+
/**
|
932
|
+
* Returns the hour11 of `self` for the given time zone
|
933
|
+
*
|
934
|
+
* @category Getters
|
935
|
+
*/
|
936
|
+
export declare const getHour11: MTypes.OneArgFunction<Type, number>;
|
937
|
+
/**
|
938
|
+
* Returns the meridiem of `self` for the given time zone
|
939
|
+
*
|
940
|
+
* @category Getters
|
941
|
+
*/
|
942
|
+
export declare const getMeridiem: MTypes.OneArgFunction<Type, 0 | 12>;
|
943
|
+
/**
|
944
|
+
* Returns the minute of `self` for the given time zone
|
945
|
+
*
|
946
|
+
* @category Getters
|
947
|
+
*/
|
948
|
+
export declare const getMinute: MTypes.OneArgFunction<Type, number>;
|
949
|
+
/**
|
950
|
+
* Returns the second of `self` for the given time zone
|
951
|
+
*
|
952
|
+
* @category Getters
|
953
|
+
*/
|
954
|
+
export declare const getSecond: MTypes.OneArgFunction<Type, number>;
|
955
|
+
/**
|
956
|
+
* Returns the millisecond of `self` for the given time zone
|
957
|
+
*
|
958
|
+
* @category Getters
|
959
|
+
*/
|
960
|
+
export declare const getMillisecond: MTypes.OneArgFunction<Type, number>;
|
961
|
+
/**
|
962
|
+
* Returns the hour part of the zoneOffset of `self`
|
963
|
+
*
|
964
|
+
* @category Getters
|
965
|
+
*/
|
966
|
+
export declare const getZoneHour: MTypes.OneArgFunction<Type, number>;
|
967
|
+
/**
|
968
|
+
* Returns the minute part of the zoneOffset of `self`
|
969
|
+
*
|
970
|
+
* @category Getters
|
971
|
+
*/
|
972
|
+
export declare const getZoneMinute: MTypes.OneArgFunction<Type, number>;
|
973
|
+
/**
|
974
|
+
* Returns the minute part of the zoneOffset of `self`
|
975
|
+
*
|
976
|
+
* @category Getters
|
977
|
+
*/
|
978
|
+
export declare const getZoneSecond: MTypes.OneArgFunction<Type, number>;
|
979
|
+
/**
|
980
|
+
* If possible, returns a right of a DateTime having year `year` and the same `month`, `monthDay`,
|
981
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of an
|
982
|
+
* error otherwise. `year` must be an integer comprised in the range [MIN_FULL_YEAR,
|
983
|
+
* MAX_FULL_YEAR].
|
984
|
+
*
|
985
|
+
* @category Setters
|
986
|
+
*/
|
987
|
+
export declare const setYear: (year: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
988
|
+
/**
|
989
|
+
* Same as setYear but returns directly a DateTime or throws in case of an error
|
990
|
+
*
|
991
|
+
* @category Setters
|
992
|
+
*/
|
993
|
+
export declare const setYearOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
994
|
+
/**
|
995
|
+
* If possible, returns a right of a DateTime having ordinalDay `ordinalDay` and the same `year`,
|
996
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of an
|
997
|
+
* error otherwise. `ordinalDay` must be an integer greater than or equal to 1 and less than or
|
998
|
+
* equal to the number of days in the current year
|
999
|
+
*
|
1000
|
+
* @category Setters
|
1001
|
+
*/
|
1002
|
+
export declare const setOrdinalDay: (ordinalDay: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1003
|
+
/**
|
1004
|
+
* Same as setOrdinalDay but returns directly a DateTime or throws in case of an error
|
1005
|
+
*
|
1006
|
+
* @category Setters
|
1007
|
+
*/
|
1008
|
+
export declare const setOrdinalDayOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1009
|
+
/**
|
1010
|
+
* If possible, returns a right of a DateTime having month `month` and the same `year`, `monthDay`,
|
1011
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of an
|
1012
|
+
* error otherwise. `month` must be an integer greater than or equal to 1 (January) and less than or
|
1013
|
+
* equal to 12 (December)
|
1014
|
+
*
|
1015
|
+
* @category Setters
|
1016
|
+
*/
|
1017
|
+
export declare const setMonth: (month: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1018
|
+
/**
|
1019
|
+
* Same as setMonth but returns directly a DateTime or throws in case of an error
|
1020
|
+
*
|
1021
|
+
* @category Setters
|
1022
|
+
*/
|
1023
|
+
export declare const setMonthOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1024
|
+
/**
|
1025
|
+
* If possible, returns a right of a DateTime having monthDay `monthDay` and the same `year`,
|
1026
|
+
* `month`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left`
|
1027
|
+
* of an error otherwise. `monthDay` must be an integer greater than or equal to 1 and less than or
|
1028
|
+
* equal to the number of days in the current month.
|
1029
|
+
*
|
1030
|
+
* @category Setters
|
1031
|
+
*/
|
1032
|
+
export declare const setMonthDay: (monthDay: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1033
|
+
/**
|
1034
|
+
* Same as setMonthDay but returns directly a DateTime or throws in case of an error
|
1035
|
+
*
|
1036
|
+
* @category Setters
|
1037
|
+
*/
|
1038
|
+
export declare const setMonthDayOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1039
|
+
/**
|
1040
|
+
* If possible, returns a right of a DateTime having isoYear `isoYear` and the same `isoWeek`,
|
1041
|
+
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1042
|
+
* `left` of an error otherwise. `isoYear` must be an integer comprised in the range [MIN_FULL_YEAR,
|
1043
|
+
* MAX_FULL_YEAR].
|
1044
|
+
*
|
1045
|
+
* @category Setters
|
1046
|
+
*/
|
1047
|
+
export declare const setIsoYear: (isoYear: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1048
|
+
/**
|
1049
|
+
* Same as setIsoYear but returns directly a DateTime or throws in case of an error
|
1050
|
+
*
|
1051
|
+
* @category Setters
|
1052
|
+
*/
|
1053
|
+
export declare const setIsoYearOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1054
|
+
/**
|
1055
|
+
* If possible, returns a right of a DateTime having isoWeek `isoWeek` and the same `isoYear`,
|
1056
|
+
* `weekday`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1057
|
+
* `left` of an error otherwise. `isoWeek` must be an integer greater than or equal to 1 and less
|
1058
|
+
* than or equal to the number of iso weeks in the current year.
|
1059
|
+
*
|
1060
|
+
* @category Setters
|
1061
|
+
*/
|
1062
|
+
export declare const setIsoWeek: (isoWeek: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1063
|
+
/**
|
1064
|
+
* Same as setIsoWeek but returns directly a DateTime or throws in case of an error
|
1065
|
+
*
|
1066
|
+
* @category Setters
|
1067
|
+
*/
|
1068
|
+
export declare const setIsoWeekOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1069
|
+
/**
|
1070
|
+
* If possible, returns a right of a DateTime having weekday `weekday` and the same `isoYear`,
|
1071
|
+
* `isoWeek`, `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1072
|
+
* `left` of an error otherwise. `weekday` must be an integer greater than or equal to 1 (monday)
|
1073
|
+
* and less than or equal to 7 (sunday).
|
1074
|
+
*
|
1075
|
+
* @category Setters
|
1076
|
+
*/
|
1077
|
+
export declare const setWeekday: (weekday: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1078
|
+
/**
|
1079
|
+
* Same as setWeekday but returns directly a DateTime or throws in case of an error
|
1080
|
+
*
|
1081
|
+
* @category Setters
|
1082
|
+
*/
|
1083
|
+
export declare const setWeekdayOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1084
|
+
/**
|
1085
|
+
* If possible, returns a right of a DateTime having hour23 `hour23` and the same `year`,
|
1086
|
+
* `ordinalDay`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of
|
1087
|
+
* an error otherwise. `hour23` must be an integer greater than or equal to 0 and less than or equal
|
1088
|
+
* to 23
|
1089
|
+
*
|
1090
|
+
* @category Setters
|
1091
|
+
*/
|
1092
|
+
export declare const setHour23: (hour23: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1093
|
+
/**
|
1094
|
+
* Same as setHour23 but returns directly a DateTime or throws in case of an error
|
1095
|
+
*
|
1096
|
+
* @category Setters
|
1097
|
+
*/
|
1098
|
+
export declare const setHour23OrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1099
|
+
/**
|
1100
|
+
* If possible, returns a right of a DateTime having hour11 `hour11` and the same `year`,
|
1101
|
+
* `ordinalDay`, `meridiem`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a
|
1102
|
+
* `left` of an error otherwise. `hour11` must be an integer greater than or equal to 0 and less
|
1103
|
+
* than or equal to 11.
|
1104
|
+
*
|
1105
|
+
* @category Setters
|
1106
|
+
*/
|
1107
|
+
export declare const setHour11: (hour11: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1108
|
+
/**
|
1109
|
+
* Same as setHour11 but returns directly a DateTime or throws in case of an error
|
1110
|
+
*
|
1111
|
+
* @category Setters
|
1112
|
+
*/
|
1113
|
+
export declare const setHour11OrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1114
|
+
/**
|
1115
|
+
* Returns a DateTime having meridiem `meridiem` and the same `year`, `ordinalDay`, `hour11`,
|
1116
|
+
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`
|
1117
|
+
*
|
1118
|
+
* @category Setters
|
1119
|
+
*/
|
1120
|
+
export declare const setMeridiem: (meridiem: 0 | 12) => (self: Type) => Type;
|
1121
|
+
/**
|
1122
|
+
* If possible, returns a right of a DateTime having minute `minute` and the same `year`,
|
1123
|
+
* `ordinalDay`, `hour23`, `second`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of
|
1124
|
+
* an error otherwise. `minute` must be an integer greater than or equal to 0 and less than or equal
|
1125
|
+
* to 59
|
1126
|
+
*
|
1127
|
+
* @category Setters
|
1128
|
+
*/
|
1129
|
+
export declare const setMinute: (minute: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1130
|
+
/**
|
1131
|
+
* Same as setMinute but returns directly a DateTime or throws in case of an error
|
1132
|
+
*
|
1133
|
+
* @category Setters
|
1134
|
+
*/
|
1135
|
+
export declare const setMinuteOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1136
|
+
/**
|
1137
|
+
* If possible, returns a right of a DateTime having second `second` and the same `year`,
|
1138
|
+
* `ordinalDay`, `hour23`, `minute`, `millisecond` and `zoneOffset` as `self`. Returns a `left` of
|
1139
|
+
* an error otherwise. `second` must be an integer greater than or equal to 0 and less than or equal
|
1140
|
+
* to 59
|
1141
|
+
*
|
1142
|
+
* @category Setters
|
1143
|
+
*/
|
1144
|
+
export declare const setSecond: (second: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1145
|
+
/**
|
1146
|
+
* Same as setSecond but returns directly a DateTime or throws in case of an error
|
1147
|
+
*
|
1148
|
+
* @category Setters
|
1149
|
+
*/
|
1150
|
+
export declare const setSecondOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1151
|
+
/**
|
1152
|
+
* If possible, returns a right of a DateTime having millisecond `millisecond` and the same `year`,
|
1153
|
+
* `ordinalDay`, `hour23`, `minute`, `second` and `zoneOffset` as `self`. Returns a `left` of an
|
1154
|
+
* error otherwise. `millisecond` must be an integer greater than or equal to 0 and less than or
|
1155
|
+
* equal to 999.
|
1156
|
+
*
|
1157
|
+
* @category Setters
|
1158
|
+
*/
|
1159
|
+
export declare const setMillisecond: (millisecond: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1160
|
+
/**
|
1161
|
+
* Same as setMillisecond but returns directly a DateTime or throws in case of an error
|
1162
|
+
*
|
1163
|
+
* @category Setters
|
1164
|
+
*/
|
1165
|
+
export declare const setMillisecondOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1166
|
+
/**
|
1167
|
+
* If possible, returns a right of a copy of `self` with the same timestamp and zoneOffset set to
|
1168
|
+
* `zoneOffset`.
|
1169
|
+
*
|
1170
|
+
* If `zoneOffset` is omitted, the local time zone offset of the machine this code is running on is
|
1171
|
+
* used.
|
1172
|
+
*
|
1173
|
+
* `zoneOffset` can be expressed as as a number of hours. In this case, it must be strictly greater
|
1174
|
+
* to -13 and strictly less than 15.
|
1175
|
+
*
|
1176
|
+
* It can also be expressed as an object containing three components:
|
1177
|
+
*
|
1178
|
+
* - `zoneHour` which must be greater than or equal to -12 and less than or equal to 14.
|
1179
|
+
* - `zoneMinute` which must be greater than or equal to 0 and less than or equal to 59.
|
1180
|
+
* - `zoneSecond` which must be greater than or equal to 0 and less than or equal to 59.
|
1181
|
+
*
|
1182
|
+
* `zoneHour`, `zoneMinute` and `zoneSecond` should be integers. `zoneOffset`, when expressed as a
|
1183
|
+
* number of hours, does not need to be an integer.
|
1184
|
+
*
|
1185
|
+
* @category Setters
|
1186
|
+
*/
|
1187
|
+
export declare const setZoneOffsetKeepTimestamp: (zoneOffset?: number | {
|
1188
|
+
readonly zoneHour: number;
|
1189
|
+
readonly zoneMinute: number;
|
1190
|
+
readonly zoneSecond: number;
|
1191
|
+
}) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1192
|
+
/**
|
1193
|
+
* Same as setZoneOffsetKeepTimestamp but returns directly a DateTime or throws in case of an error
|
1194
|
+
*
|
1195
|
+
* @category Setters
|
1196
|
+
*/
|
1197
|
+
export declare const setZoneOffsetKeepTimestampOrThrow: MTypes.OneArgFunction<number | {
|
1198
|
+
readonly zoneHour: number;
|
1199
|
+
readonly zoneMinute: number;
|
1200
|
+
readonly zoneSecond: number;
|
1201
|
+
}, MTypes.OneArgFunction<Type>>;
|
1202
|
+
/**
|
1203
|
+
* If possible, returns a right of a copy of `self` with the same CVDateTime.Parts (except
|
1204
|
+
* zoneOffset) and zoneOffset set to `zoneOffset`.
|
1205
|
+
*
|
1206
|
+
* See setZoneOffsetKeepTimestamp for more details
|
1207
|
+
*
|
1208
|
+
* @category Setters
|
1209
|
+
*/
|
1210
|
+
export declare const setZoneOffsetKeepParts: (zoneOffset?: number | {
|
1211
|
+
readonly zoneHour: number;
|
1212
|
+
readonly zoneMinute: number;
|
1213
|
+
readonly zoneSecond: number;
|
1214
|
+
}) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1215
|
+
/**
|
1216
|
+
* Same as setZoneOffsetKeepTimestamp but returns directly a DateTime or throws in case of an error
|
1217
|
+
*
|
1218
|
+
* @category Setters
|
1219
|
+
*/
|
1220
|
+
export declare const setZoneOffsetKeepPartsOrThrow: MTypes.OneArgFunction<number | {
|
1221
|
+
readonly zoneHour: number;
|
1222
|
+
readonly zoneMinute: number;
|
1223
|
+
readonly zoneSecond: number;
|
1224
|
+
}, MTypes.OneArgFunction<Type>>;
|
1225
|
+
/**
|
1226
|
+
* Returns true if self is the first day of a month in the given timezone
|
1227
|
+
*
|
1228
|
+
* @category Predicates
|
1229
|
+
*/
|
1230
|
+
export declare const isFirstMonthDay: Predicate.Predicate<Type>;
|
1231
|
+
/**
|
1232
|
+
* Returns true if self is the last day of a month in the given timezone
|
1233
|
+
*
|
1234
|
+
* @category Predicates
|
1235
|
+
*/
|
1236
|
+
export declare const isLastMonthDay: Predicate.Predicate<Type>;
|
1237
|
+
/**
|
1238
|
+
* Returns true if self is the first day of a year in the given timezone
|
1239
|
+
*
|
1240
|
+
* @category Predicates
|
1241
|
+
*/
|
1242
|
+
export declare const isFirstYearDay: Predicate.Predicate<Type>;
|
1243
|
+
/**
|
1244
|
+
* Returns true if self is the last day of a year in the given timezone
|
1245
|
+
*
|
1246
|
+
* @category Predicates
|
1247
|
+
*/
|
1248
|
+
export declare const isLastYearDay: Predicate.Predicate<Type>;
|
1249
|
+
/**
|
1250
|
+
* Returns true if self is the first day of an iso year in the given timezone
|
1251
|
+
*
|
1252
|
+
* @category Predicates
|
1253
|
+
*/
|
1254
|
+
export declare const isFirstIsoYearDay: Predicate.Predicate<Type>;
|
1255
|
+
/**
|
1256
|
+
* Returns true if self is the last day of an iso year in the given timezone
|
1257
|
+
*
|
1258
|
+
* @category Predicates
|
1259
|
+
*/
|
1260
|
+
export declare const isLastIsoYearDay: Predicate.Predicate<Type>;
|
1261
|
+
/**
|
1262
|
+
* Returns a copy of `self` where `monthDay` is set to the first day of the current month. All time
|
1263
|
+
* parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`, `millisecond`) are left unchanged
|
1264
|
+
*
|
1265
|
+
* @category Offsetters
|
1266
|
+
*/
|
1267
|
+
export declare const toFirstMonthDay: MTypes.OneArgFunction<Type>;
|
1268
|
+
/**
|
1269
|
+
* Returns a copy of `self` where `monthDay` is set to the last day of the current month. All time
|
1270
|
+
* parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`, `millisecond`) are left unchanged
|
1271
|
+
*
|
1272
|
+
* @category Offsetters
|
1273
|
+
*/
|
1274
|
+
export declare const toLastMonthDay: (self: Type) => Type;
|
1275
|
+
/**
|
1276
|
+
* Returns a copy of `self` where `ordinalDay` is set to the first day of the current year. All time
|
1277
|
+
* parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`, `millisecond`) are left unchanged
|
1278
|
+
*
|
1279
|
+
* @category Offsetters
|
1280
|
+
*/
|
1281
|
+
export declare const toFirstYearDay: (self: Type) => Type;
|
1282
|
+
/**
|
1283
|
+
* Returns a copy of `self` where `ordinalDay` is set to the last day of the current year. All time
|
1284
|
+
* parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`, `millisecond`) are left unchanged
|
1285
|
+
*
|
1286
|
+
* @category Offsetters
|
1287
|
+
*/
|
1288
|
+
export declare const toLastYearDay: (self: Type) => Type;
|
1289
|
+
/**
|
1290
|
+
* Returns a copy of `self` where `isoWeek` and `weekday` are set to 1. All time parts (`hour23`,
|
1291
|
+
* `hour11`, `meridiem`, `minute`, `second`, `millisecond`) are left unchanged
|
1292
|
+
*
|
1293
|
+
* @category Offsetters
|
1294
|
+
*/
|
1295
|
+
export declare const toFirstIsoYearDay: MTypes.OneArgFunction<Type>;
|
1296
|
+
/**
|
1297
|
+
* Returns a copy of `self` where `isoWeek` is set to the last week of the current iso year.
|
1298
|
+
* `weekday` and all time parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`, `millisecond`)
|
1299
|
+
* are left unchanged
|
1300
|
+
*
|
1301
|
+
* @category Offsetters
|
1302
|
+
*/
|
1303
|
+
export declare const toLastIsoYearWeek: (self: Type) => Type;
|
1304
|
+
/**
|
1305
|
+
* Returns a copy of `self` where `isoWeek` is set to the last week of the current iso year and
|
1306
|
+
* `weekday` is set to 7. All time parts (`hour23`, `hour11`, `meridiem`, `minute`, `second`,
|
1307
|
+
* `millisecond`) are left unchanged
|
1308
|
+
*
|
1309
|
+
* @category Offsetters
|
1310
|
+
*/
|
1311
|
+
export declare const toLastIsoYearDay: (self: Type) => Type;
|
1312
|
+
/**
|
1313
|
+
* If possible, returns a copy of `self` offset by `offset` years and having the same `month`,
|
1314
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. If `respectMonthEnd` is
|
1315
|
+
* true and `self` is on the last day of a month, the new DateTime object's monthDay will be the
|
1316
|
+
* last of the target month. Otherwise, it will be the same as `self`'s. Returns a `left` of an
|
1317
|
+
* error otherwise.
|
1318
|
+
*
|
1319
|
+
* @category Offsetters
|
1320
|
+
*/
|
1321
|
+
export declare const offsetYears: (offset: number, respectMonthEnd: boolean) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1322
|
+
/**
|
1323
|
+
* Same as offsetYears but returns directly a DateTime or throws in case of an error
|
1324
|
+
*
|
1325
|
+
* @category Setters
|
1326
|
+
*/
|
1327
|
+
export declare const offsetYearsOrThrow: (offset: number, respectMonthEnd: boolean) => MTypes.OneArgFunction<Type>;
|
1328
|
+
/**
|
1329
|
+
* If possible, returns a copy of `self` offset by `offset` months and having the same `hour23`,
|
1330
|
+
* `minute`, `second`, `millisecond` and `zoneOffset` as `self`. If `respectMonthEnd` is true and
|
1331
|
+
* `self` is on the last day of a month, the new DateTime object's monthDay will be the last of the
|
1332
|
+
* target month. Otherwise, it will be the same as `self`'s. Returns a `left` of an error if the
|
1333
|
+
* DateTime object can
|
1334
|
+
*
|
1335
|
+
* @category Offsetters
|
1336
|
+
*/
|
1337
|
+
export declare const offsetMonths: (offset: number, respectMonthEnd: boolean) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1338
|
+
/**
|
1339
|
+
* Same as offsetMonths but returns directly a DateTime or throws in case of an error
|
1340
|
+
*
|
1341
|
+
* @category Setters
|
1342
|
+
*/
|
1343
|
+
export declare const offsetMonthsOrThrow: (offset: number, respectMonthEnd: boolean) => MTypes.OneArgFunction<Type>;
|
1344
|
+
/**
|
1345
|
+
* Returns a copy of `self` offset by `offset` days
|
1346
|
+
*
|
1347
|
+
* @category Offsetters
|
1348
|
+
*/
|
1349
|
+
export declare const offsetDays: (offset: number) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1350
|
+
/**
|
1351
|
+
* Same as offsetDays but returns directly a DateTime or throws in case of an error
|
1352
|
+
*
|
1353
|
+
* @category Setters
|
1354
|
+
*/
|
1355
|
+
export declare const offsetDaysOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1356
|
+
/**
|
1357
|
+
* If possible, returns a copy of `self` offset by `offset` iso years and having the same `weekday`,
|
1358
|
+
* `hour23`, `minute`, `second`, `millisecond` and `zoneOffset` as `self`. If `respectYearEnd` is
|
1359
|
+
* true and `self` is on the last day of an iso year, the new DateTime object's isoWeek will be the
|
1360
|
+
* last of the target iso year. Otherwise, it will be the same as `self`'s. Returns a `left` of an
|
1361
|
+
* error otherwise.
|
1362
|
+
*
|
1363
|
+
* @category Offsetters
|
1364
|
+
*/
|
1365
|
+
export declare const offsetIsoYears: (offset: number, respectYearEnd: boolean) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1366
|
+
/**
|
1367
|
+
* Same as offsetIsoYears but returns directly a DateTime or throws in case of an error
|
1368
|
+
*
|
1369
|
+
* @category Setters
|
1370
|
+
*/
|
1371
|
+
export declare const offsetIsoYearsOrThrow: (offset: number, respectYearEnd: boolean) => MTypes.OneArgFunction<Type>;
|
1372
|
+
/**
|
1373
|
+
* Returns a copy of `self` offset by `offset` hours
|
1374
|
+
*
|
1375
|
+
* @category Offsetters
|
1376
|
+
*/
|
1377
|
+
export declare const offsetHours: (offset: number) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1378
|
+
/**
|
1379
|
+
* Same as offsetHours but returns directly a DateTime or throws in case of an error
|
1380
|
+
*
|
1381
|
+
* @category Setters
|
1382
|
+
*/
|
1383
|
+
export declare const offsetHoursOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1384
|
+
/**
|
1385
|
+
* Returns a copy of `self` offset by `offset` minutes
|
1386
|
+
*
|
1387
|
+
* @category Offsetters
|
1388
|
+
*/
|
1389
|
+
export declare const offsetMinutes: (offset: number) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1390
|
+
/**
|
1391
|
+
* Same as offsetMinutes but returns directly a DateTime or throws in case of an error
|
1392
|
+
*
|
1393
|
+
* @category Setters
|
1394
|
+
*/
|
1395
|
+
export declare const offsetMinutesOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1396
|
+
/**
|
1397
|
+
* Returns a copy of `self` offset by `offset` seconds
|
1398
|
+
*
|
1399
|
+
* @category Offsetters
|
1400
|
+
*/
|
1401
|
+
export declare const offsetSeconds: (offset: number) => MTypes.OneArgFunction<Type, Either.Either<Type, MInputError.Type>>;
|
1402
|
+
/**
|
1403
|
+
* Same as offsetSeconds but returns directly a DateTime or throws in case of an error
|
1404
|
+
*
|
1405
|
+
* @category Setters
|
1406
|
+
*/
|
1407
|
+
export declare const offsetSecondsOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1408
|
+
/**
|
1409
|
+
* Returns a copy of `self` offset by `offset` milliseconds
|
1410
|
+
*
|
1411
|
+
* @category Offsetters
|
1412
|
+
*/
|
1413
|
+
export declare const offsetMilliseconds: (offset: number) => (self: Type) => Either.Either<Type, MInputError.Type>;
|
1414
|
+
/**
|
1415
|
+
* Same as offsetMilliseconds but returns directly a DateTime or throws in case of an error
|
1416
|
+
*
|
1417
|
+
* @category Setters
|
1418
|
+
*/
|
1419
|
+
export declare const offsetMillisecondsOrThrow: MTypes.OneArgFunction<number, MTypes.OneArgFunction<Type>>;
|
1420
|
+
export {};
|
1421
|
+
//# sourceMappingURL=DateTime.d.ts.map
|