@naturalcycles/js-lib 14.100.0 → 14.101.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/dist/datetime/localDate.d.ts +2 -2
- package/dist/datetime/localTime.d.ts +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
- package/src/datetime/localDate.ts +7 -2
- package/src/datetime/localTime.ts +8 -3
- package/src/index.ts +2 -0
- package/src/types.ts +7 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsoDateString, IsoDateTimeString, UnixTimestampNumber } from '../types';
|
|
1
|
+
import { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
|
|
2
2
|
import { LocalTime } from './localTime';
|
|
3
3
|
export declare type LocalDateUnit = LocalDateUnitStrict | 'week';
|
|
4
4
|
export declare type LocalDateUnitStrict = 'year' | 'month' | 'day';
|
|
@@ -89,7 +89,7 @@ export declare class LocalDate {
|
|
|
89
89
|
toString(): IsoDateString;
|
|
90
90
|
toStringCompact(): string;
|
|
91
91
|
unix(): UnixTimestampNumber;
|
|
92
|
-
unixMillis():
|
|
92
|
+
unixMillis(): UnixTimestampMillisNumber;
|
|
93
93
|
toJSON(): IsoDateString;
|
|
94
94
|
format(fmt: LocalDateFormatter): string;
|
|
95
95
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsoDateString, IsoDateTimeString, UnixTimestampNumber } from '../types';
|
|
1
|
+
import { IsoDateString, IsoDateTimeString, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
|
|
2
2
|
import { Inclusiveness, LocalDate } from './localDate';
|
|
3
3
|
export declare type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
|
|
4
4
|
export declare enum ISODayOfWeek {
|
|
@@ -34,7 +34,7 @@ export declare class LocalTime {
|
|
|
34
34
|
/**
|
|
35
35
|
* Create LocalTime from unixTimestamp in milliseconds (not in seconds).
|
|
36
36
|
*/
|
|
37
|
-
static ofMillis(millis:
|
|
37
|
+
static ofMillis(millis: UnixTimestampMillisNumber): LocalTime;
|
|
38
38
|
/**
|
|
39
39
|
* Returns null if invalid
|
|
40
40
|
*/
|
|
@@ -97,7 +97,7 @@ export declare class LocalTime {
|
|
|
97
97
|
getDate(): Date;
|
|
98
98
|
clone(): LocalTime;
|
|
99
99
|
unix(): UnixTimestampNumber;
|
|
100
|
-
unixMillis():
|
|
100
|
+
unixMillis(): UnixTimestampMillisNumber;
|
|
101
101
|
valueOf(): UnixTimestampNumber;
|
|
102
102
|
toLocalDate(): LocalDate;
|
|
103
103
|
toPretty(seconds?: boolean): IsoDateTimeString;
|
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export * from './string/string.util';
|
|
|
51
51
|
import { JsonStringifyFunction, StringifyAnyOptions, _stringifyAny } from './string/stringifyAny';
|
|
52
52
|
export * from './time/time.util';
|
|
53
53
|
import { Class, ConditionalExcept, ConditionalPick, Merge, Promisable, ReadonlyDeep, Simplify } from './typeFest';
|
|
54
|
-
import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, UnsavedId, BatchResult, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestampNumber, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, END, SKIP, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
|
|
54
|
+
import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, UnsavedId, BatchResult, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestampNumber, UnixTimestampMillisNumber, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, END, SKIP, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
|
|
55
55
|
export * from './unit/size.util';
|
|
56
56
|
import { is } from './vendor/is';
|
|
57
57
|
import { CommonLogLevel, CommonLogFunction, CommonLogger, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, CommonLogWithLevelFunction, commonLoggerCreate } from './log/commonLogger';
|
|
@@ -68,5 +68,5 @@ import { LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict
|
|
|
68
68
|
import { LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, LocalTimeComponents, ISODayOfWeek } from './datetime/localTime';
|
|
69
69
|
import { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval';
|
|
70
70
|
import { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval';
|
|
71
|
-
export type { DateIntervalConfig, DateIntervalString, TimeIntervalConfig, TimeIntervalString, LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict, Inclusiveness, LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, ISODayOfWeek, LocalTimeComponents, AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, AsyncMemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestampNumber, UnixTimestamp, Integer, BaseDBEntity, SavedDBEntity, Saved, Unsaved, UnsavedId, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
|
|
71
|
+
export type { DateIntervalConfig, DateIntervalString, TimeIntervalConfig, TimeIntervalString, LocalDateConfig, LocalDateFormatter, LocalDateUnit, LocalDateUnitStrict, Inclusiveness, LocalTimeConfig, LocalTimeFormatter, LocalTimeUnit, ISODayOfWeek, LocalTimeComponents, AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, AsyncMemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestampNumber, UnixTimestampMillisNumber, UnixTimestamp, Integer, BaseDBEntity, SavedDBEntity, Saved, Unsaved, UnsavedId, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
|
|
72
72
|
export { is, _createPromiseDecorator, _stringMapValues, _stringMapEntries, _objectKeys, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, ErrorMode, pDefer, AggregatedError, pRetry, pRetryFn, pTimeout, pTimeoutFn, _tryCatch, _TryCatch, _stringifyAny, jsonSchema, JsonSchemaAnyBuilder, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, commonLoggerCreate, PQueue, END, SKIP, };
|
package/dist/types.d.ts
CHANGED
|
@@ -154,6 +154,12 @@ export declare type IsoDateTimeString = string;
|
|
|
154
154
|
* @example 1628945450
|
|
155
155
|
*/
|
|
156
156
|
export declare type UnixTimestampNumber = number;
|
|
157
|
+
/**
|
|
158
|
+
* Interface explicitly states that the value is a "Unix timestamp in **milleseconds**" (not seconds)
|
|
159
|
+
*
|
|
160
|
+
* @example 1628945450000
|
|
161
|
+
*/
|
|
162
|
+
export declare type UnixTimestampMillisNumber = number;
|
|
157
163
|
/**
|
|
158
164
|
* @deprecated use UnixTimestampNumber
|
|
159
165
|
*/
|
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { _assert } from '../error/assert'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IsoDateString,
|
|
4
|
+
IsoDateTimeString,
|
|
5
|
+
UnixTimestampMillisNumber,
|
|
6
|
+
UnixTimestampNumber,
|
|
7
|
+
} from '../types'
|
|
3
8
|
import { LocalTime } from './localTime'
|
|
4
9
|
|
|
5
10
|
export type LocalDateUnit = LocalDateUnitStrict | 'week'
|
|
@@ -477,7 +482,7 @@ export class LocalDate {
|
|
|
477
482
|
return Math.floor(this.toDate().valueOf() / 1000)
|
|
478
483
|
}
|
|
479
484
|
|
|
480
|
-
unixMillis():
|
|
485
|
+
unixMillis(): UnixTimestampMillisNumber {
|
|
481
486
|
return this.toDate().valueOf()
|
|
482
487
|
}
|
|
483
488
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { _assert } from '../error/assert'
|
|
2
2
|
import { _ms } from '../time/time.util'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
IsoDateString,
|
|
5
|
+
IsoDateTimeString,
|
|
6
|
+
UnixTimestampMillisNumber,
|
|
7
|
+
UnixTimestampNumber,
|
|
8
|
+
} from '../types'
|
|
4
9
|
import { Inclusiveness, LocalDate } from './localDate'
|
|
5
10
|
|
|
6
11
|
export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second'
|
|
@@ -59,7 +64,7 @@ export class LocalTime {
|
|
|
59
64
|
/**
|
|
60
65
|
* Create LocalTime from unixTimestamp in milliseconds (not in seconds).
|
|
61
66
|
*/
|
|
62
|
-
static ofMillis(millis:
|
|
67
|
+
static ofMillis(millis: UnixTimestampMillisNumber): LocalTime {
|
|
63
68
|
return LocalTime.of(new Date(millis))
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -478,7 +483,7 @@ export class LocalTime {
|
|
|
478
483
|
return Math.floor(this.$date.valueOf() / 1000)
|
|
479
484
|
}
|
|
480
485
|
|
|
481
|
-
unixMillis():
|
|
486
|
+
unixMillis(): UnixTimestampMillisNumber {
|
|
482
487
|
return this.$date.valueOf()
|
|
483
488
|
}
|
|
484
489
|
|
package/src/index.ts
CHANGED
|
@@ -120,6 +120,7 @@ import {
|
|
|
120
120
|
SavedDBEntity,
|
|
121
121
|
StringMap,
|
|
122
122
|
UnixTimestampNumber,
|
|
123
|
+
UnixTimestampMillisNumber,
|
|
123
124
|
UnixTimestamp,
|
|
124
125
|
Integer,
|
|
125
126
|
ValueOf,
|
|
@@ -243,6 +244,7 @@ export type {
|
|
|
243
244
|
ConditionalExcept,
|
|
244
245
|
Class,
|
|
245
246
|
UnixTimestampNumber,
|
|
247
|
+
UnixTimestampMillisNumber,
|
|
246
248
|
UnixTimestamp,
|
|
247
249
|
Integer,
|
|
248
250
|
BaseDBEntity,
|
package/src/types.ts
CHANGED
|
@@ -213,6 +213,13 @@ export type IsoDateTimeString = string
|
|
|
213
213
|
*/
|
|
214
214
|
export type UnixTimestampNumber = number
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Interface explicitly states that the value is a "Unix timestamp in **milleseconds**" (not seconds)
|
|
218
|
+
*
|
|
219
|
+
* @example 1628945450000
|
|
220
|
+
*/
|
|
221
|
+
export type UnixTimestampMillisNumber = number
|
|
222
|
+
|
|
216
223
|
/**
|
|
217
224
|
* @deprecated use UnixTimestampNumber
|
|
218
225
|
*/
|