@sjts/lib-date 7.0.2 → 7.0.4

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.
@@ -0,0 +1,2 @@
1
+ import { DateTime } from 'luxon';
2
+ export declare function dateTime2Timestamp(dateTime: DateTime): number;
@@ -0,0 +1,5 @@
1
+ export function dateTime2Timestamp(dateTime) {
2
+ if (!dateTime)
3
+ return 0;
4
+ return Math.floor(dateTime.toMillis() / 1000);
5
+ }
@@ -0,0 +1,2 @@
1
+ import { DateTime } from 'luxon';
2
+ export declare function timestamp2DateTime(timestamp: number): DateTime;
@@ -0,0 +1,6 @@
1
+ import { DateTime } from 'luxon';
2
+ export function timestamp2DateTime(timestamp) {
3
+ if (!timestamp)
4
+ return DateTime.now();
5
+ return DateTime.fromMillis(timestamp * 1000);
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjts/lib-date",
3
3
  "description": "The Steve James Typescript date utils package",
4
- "version": "7.0.2",
4
+ "version": "7.0.4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "luxon": "3.1.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@sjts/lib-dev": "7.0.1"
20
+ "@sjts/lib-dev": "7.0.2"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"