@naturalcycles/js-lib 14.259.0 → 14.260.1

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.
@@ -234,6 +234,10 @@ declare class LocalTimeFactory {
234
234
  Like Date.now(), but in seconds.
235
235
  */
236
236
  nowUnix(): UnixTimestamp;
237
+ /**
238
+ Convenience function that retuns the same as Date.now(), but with proper type of UnixTimestampMillis.
239
+ */
240
+ nowUnixMillis(): UnixTimestampMillis;
237
241
  /**
238
242
  * Create LocalTime from LocalTimeInput.
239
243
  * Input can already be a LocalTime - it is returned as-is in that case.
@@ -647,6 +647,12 @@ class LocalTimeFactory {
647
647
  nowUnix() {
648
648
  return Math.floor(Date.now() / 1000);
649
649
  }
650
+ /**
651
+ Convenience function that retuns the same as Date.now(), but with proper type of UnixTimestampMillis.
652
+ */
653
+ nowUnixMillis() {
654
+ return Date.now();
655
+ }
650
656
  /**
651
657
  * Create LocalTime from LocalTimeInput.
652
658
  * Input can already be a LocalTime - it is returned as-is in that case.
package/dist/types.d.ts CHANGED
@@ -30,8 +30,8 @@ export type AnyEnum = NumberEnum;
30
30
  export type NumberEnum = Record<string, number | string>;
31
31
  export type StringEnum = Record<string, string>;
32
32
  export type CreatedUpdated = {
33
- created: number;
34
- updated: number;
33
+ created: UnixTimestamp;
34
+ updated: UnixTimestamp;
35
35
  };
36
36
  export interface CreatedUpdatedId extends CreatedUpdated {
37
37
  id: string;
@@ -643,6 +643,12 @@ class LocalTimeFactory {
643
643
  nowUnix() {
644
644
  return Math.floor(Date.now() / 1000);
645
645
  }
646
+ /**
647
+ Convenience function that retuns the same as Date.now(), but with proper type of UnixTimestampMillis.
648
+ */
649
+ nowUnixMillis() {
650
+ return Date.now();
651
+ }
646
652
  /**
647
653
  * Create LocalTime from LocalTimeInput.
648
654
  * Input can already be a LocalTime - it is returned as-is in that case.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.259.0",
3
+ "version": "14.260.1",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build-esm-cjs",
@@ -776,6 +776,13 @@ class LocalTimeFactory {
776
776
  return Math.floor(Date.now() / 1000) as UnixTimestamp
777
777
  }
778
778
 
779
+ /**
780
+ Convenience function that retuns the same as Date.now(), but with proper type of UnixTimestampMillis.
781
+ */
782
+ nowUnixMillis(): UnixTimestampMillis {
783
+ return Date.now() as UnixTimestampMillis
784
+ }
785
+
779
786
  /**
780
787
  * Create LocalTime from LocalTimeInput.
781
788
  * Input can already be a LocalTime - it is returned as-is in that case.
package/src/types.ts CHANGED
@@ -38,8 +38,8 @@ export type StringEnum = Record<string, string>
38
38
 
39
39
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
40
40
  export type CreatedUpdated = {
41
- created: number
42
- updated: number
41
+ created: UnixTimestamp
42
+ updated: UnixTimestamp
43
43
  }
44
44
 
45
45
  export interface CreatedUpdatedId extends CreatedUpdated {