@leancodepl/api-date-dayjs 7.3.7 → 7.5.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/index.cjs.js +8 -1
- package/index.esm.d.ts +1 -0
- package/index.esm.js +8 -1
- package/package.json +3 -3
- package/src/lib/date/fromApiDate.d.ts +1 -1
- package/src/lib/date/toApiDate.d.ts +1 -1
- package/src/lib/dateTimeOffset/fromApiDateTimeOffset.d.ts +1 -1
- package/src/lib/dateTimeOffset/toApiDateTimeOffset.d.ts +1 -1
- package/src/lib/time/fromApiTime.d.ts +1 -1
- package/src/lib/time/toApiTime.d.ts +1 -1
- package/src/lib/timeSpan/fromApiTimeSpan.d.ts +1 -1
- package/src/lib/timeSpan/toApiTimeSpan.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -6,8 +6,8 @@ var apiDate = require('@leancodepl/api-date');
|
|
|
6
6
|
var dayjs = require('dayjs');
|
|
7
7
|
var customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
8
8
|
var utc = require('dayjs/plugin/utc');
|
|
9
|
-
var apiDateUtils = require('@leancodepl/api-date-utils');
|
|
10
9
|
var duration = require('dayjs/plugin/duration');
|
|
10
|
+
var apiDateUtils = require('@leancodepl/api-date-utils');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -21,6 +21,7 @@ function fromApiTime(time) {
|
|
|
21
21
|
if (!time) {
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
25
|
return dayjs__default["default"](time, "HH:mm:ss.SSS");
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -28,10 +29,12 @@ function toApiTime(time) {
|
|
|
28
29
|
if (!time) {
|
|
29
30
|
return undefined;
|
|
30
31
|
}
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
33
|
return time.format("HH:mm:ss.SSS");
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function fromApiDate(date) {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
38
|
return dayjs__default["default"](date);
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -43,6 +46,7 @@ dayjs__default["default"].extend(utc__default["default"]);
|
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
function toApiDate(date) {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
50
|
return dropLocalOffset(date).startOf("day").format("YYYY-MM-DD");
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -51,6 +55,7 @@ function fromApiDateTimeOffset(datetime) {
|
|
|
51
55
|
if (!datetime) {
|
|
52
56
|
return undefined;
|
|
53
57
|
}
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
59
|
return dayjs__default["default"](datetime, "YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -58,6 +63,7 @@ function toApiDateTimeOffset(time) {
|
|
|
58
63
|
if (!time) {
|
|
59
64
|
return undefined;
|
|
60
65
|
}
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
67
|
return time.format("YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -91,6 +97,7 @@ function toApiTimeSpan(duration) {
|
|
|
91
97
|
stringTimeSpan += `${days}.`;
|
|
92
98
|
}
|
|
93
99
|
stringTimeSpan += absDuration.format("HH:mm:ss.SSS");
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
101
|
return stringTimeSpan;
|
|
95
102
|
}
|
|
96
103
|
|
package/index.esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
CHANGED
|
@@ -2,14 +2,15 @@ export * from '@leancodepl/api-date';
|
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
4
|
import utc from 'dayjs/plugin/utc';
|
|
5
|
-
import { parseApiTimeSpan } from '@leancodepl/api-date-utils';
|
|
6
5
|
import duration from 'dayjs/plugin/duration';
|
|
6
|
+
import { parseApiTimeSpan } from '@leancodepl/api-date-utils';
|
|
7
7
|
|
|
8
8
|
dayjs.extend(customParseFormat);
|
|
9
9
|
function fromApiTime(time) {
|
|
10
10
|
if (!time) {
|
|
11
11
|
return undefined;
|
|
12
12
|
}
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
return dayjs(time, "HH:mm:ss.SSS");
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -17,10 +18,12 @@ function toApiTime(time) {
|
|
|
17
18
|
if (!time) {
|
|
18
19
|
return undefined;
|
|
19
20
|
}
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
22
|
return time.format("HH:mm:ss.SSS");
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function fromApiDate(date) {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
27
|
return dayjs(date);
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -32,6 +35,7 @@ dayjs.extend(utc);
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
function toApiDate(date) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
39
|
return dropLocalOffset(date).startOf("day").format("YYYY-MM-DD");
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -40,6 +44,7 @@ function fromApiDateTimeOffset(datetime) {
|
|
|
40
44
|
if (!datetime) {
|
|
41
45
|
return undefined;
|
|
42
46
|
}
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
48
|
return dayjs(datetime, "YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -47,6 +52,7 @@ function toApiDateTimeOffset(time) {
|
|
|
47
52
|
if (!time) {
|
|
48
53
|
return undefined;
|
|
49
54
|
}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
56
|
return time.format("YYYY-MM-DDTHH:mm:ss.SSSZ");
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -80,6 +86,7 @@ function toApiTimeSpan(duration) {
|
|
|
80
86
|
stringTimeSpan += `${days}.`;
|
|
81
87
|
}
|
|
82
88
|
stringTimeSpan += absDuration.format("HH:mm:ss.SSS");
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
90
|
return stringTimeSpan;
|
|
84
91
|
}
|
|
85
92
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/api-date-dayjs",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@leancodepl/api-date": "7.
|
|
7
|
-
"@leancodepl/api-date-utils": "7.
|
|
6
|
+
"@leancodepl/api-date": "7.5.0",
|
|
7
|
+
"@leancodepl/api-date-utils": "7.5.0",
|
|
8
8
|
"dayjs": ">=1.9.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ApiTimeSpan } from "@leancodepl/api-date";
|
|
2
1
|
import duration from "dayjs/plugin/duration";
|
|
2
|
+
import type { ApiTimeSpan } from "@leancodepl/api-date";
|
|
3
3
|
/**
|
|
4
4
|
*This function handles at most milliseconds precision, smaller units are lost in conversion process
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ApiTimeSpan } from "@leancodepl/api-date";
|
|
2
1
|
import duration from "dayjs/plugin/duration";
|
|
2
|
+
import type { ApiTimeSpan } from "@leancodepl/api-date";
|
|
3
3
|
/**
|
|
4
4
|
*This function handles at most milliseconds precision, smaller units are lost in conversion process
|
|
5
5
|
*/
|