kcommons 18.26.5 → 18.26.7
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.
|
@@ -227,6 +227,7 @@ export interface IGRNMetafields {
|
|
|
227
227
|
approval_logs: INestedEntityApprovalChainEntryLog[] | null;
|
|
228
228
|
vendor: INestedVendor | null;
|
|
229
229
|
approval_chain_stage_names: INestedEntityApprovalChainStageNames[] | null;
|
|
230
|
+
parent_po_items_data: INestedPOItem[] | null;
|
|
230
231
|
}
|
|
231
232
|
export declare enum GRN_METAFIELDS_INCLUDE {
|
|
232
233
|
items_data = "items_data",
|
|
@@ -234,7 +235,8 @@ export declare enum GRN_METAFIELDS_INCLUDE {
|
|
|
234
235
|
supplier_invoice_user_data = "supplier_invoice_user_data",
|
|
235
236
|
approval_logs = "approval_logs",
|
|
236
237
|
vendor = "vendor",
|
|
237
|
-
approval_chain_stage_names = "approval_chain_stage_names"
|
|
238
|
+
approval_chain_stage_names = "approval_chain_stage_names",
|
|
239
|
+
parent_po_items_data = "parent_po_items_data"
|
|
238
240
|
}
|
|
239
241
|
export interface IGRNVendorQuoteItemCustomUOM {
|
|
240
242
|
quote_item_id: string | null;
|
|
@@ -96,4 +96,5 @@ var GRN_METAFIELDS_INCLUDE;
|
|
|
96
96
|
GRN_METAFIELDS_INCLUDE["approval_logs"] = "approval_logs";
|
|
97
97
|
GRN_METAFIELDS_INCLUDE["vendor"] = "vendor";
|
|
98
98
|
GRN_METAFIELDS_INCLUDE["approval_chain_stage_names"] = "approval_chain_stage_names";
|
|
99
|
+
GRN_METAFIELDS_INCLUDE["parent_po_items_data"] = "parent_po_items_data";
|
|
99
100
|
})(GRN_METAFIELDS_INCLUDE || (exports.GRN_METAFIELDS_INCLUDE = GRN_METAFIELDS_INCLUDE = {}));
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
*/
|
|
9
9
|
type TimeInput = Date | string;
|
|
10
10
|
/**
|
|
11
|
-
* Calculates the difference in seconds between two times.
|
|
11
|
+
* Calculates the absolute difference in seconds between two times. The
|
|
12
|
+
* result is never negative, so the order of `start` and `end` does not
|
|
13
|
+
* matter.
|
|
12
14
|
*
|
|
13
15
|
* The behaviour depends on the input types:
|
|
14
16
|
*
|
|
15
|
-
* - **Both `Date` objects** — the
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* is before `start`. Fractional seconds are truncated.
|
|
17
|
+
* - **Both `Date` objects** — the full date-time difference is used (via
|
|
18
|
+
* `date-fns` `differenceInSeconds`), so differences across days are
|
|
19
|
+
* included. Fractional seconds are truncated.
|
|
19
20
|
* - **Any `string` input (or a mix of `Date` and `string`)** — only the time
|
|
20
|
-
* of day is compared
|
|
21
|
-
*
|
|
22
|
-
* hours/minutes/seconds are used.
|
|
21
|
+
* of day is compared. The calendar date of any `Date` is ignored, and its
|
|
22
|
+
* local hours/minutes/seconds are used.
|
|
23
23
|
*
|
|
24
24
|
* The time-of-day result is **not** wrapped around midnight: `"22:00"` →
|
|
25
25
|
* `"02:00"` gives `72000` (the gap between the two times of day), not the
|
|
@@ -28,9 +28,8 @@ type TimeInput = Date | string;
|
|
|
28
28
|
*
|
|
29
29
|
* @param start - The start time: a `Date` or an `HH:MM` (24-hour) string.
|
|
30
30
|
* @param end - The end time: a `Date` or an `HH:MM` (24-hour) string.
|
|
31
|
-
* @returns
|
|
32
|
-
*
|
|
33
|
-
* of day (never negative).
|
|
31
|
+
* @returns The absolute number of seconds between `start` and `end`
|
|
32
|
+
* (never negative).
|
|
34
33
|
* @throws {Error} If a string input is not in `HH:MM` format, or a `Date`
|
|
35
34
|
* input is invalid (in the time-of-day comparison path).
|
|
36
35
|
*
|
|
@@ -38,7 +37,7 @@ type TimeInput = Date | string;
|
|
|
38
37
|
* calculateTimeDifferenceInSeconds("09:00", "17:30"); // 30600
|
|
39
38
|
*
|
|
40
39
|
* @example
|
|
41
|
-
* // Order does not matter
|
|
40
|
+
* // Order does not matter
|
|
42
41
|
* calculateTimeDifferenceInSeconds("18:00", "09:00"); // 32400
|
|
43
42
|
*
|
|
44
43
|
* @example
|
|
@@ -30,18 +30,18 @@ function toSeconds(input) {
|
|
|
30
30
|
return hours * 3600 + minutes * 60;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Calculates the difference in seconds between two times.
|
|
33
|
+
* Calculates the absolute difference in seconds between two times. The
|
|
34
|
+
* result is never negative, so the order of `start` and `end` does not
|
|
35
|
+
* matter.
|
|
34
36
|
*
|
|
35
37
|
* The behaviour depends on the input types:
|
|
36
38
|
*
|
|
37
|
-
* - **Both `Date` objects** — the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* is before `start`. Fractional seconds are truncated.
|
|
39
|
+
* - **Both `Date` objects** — the full date-time difference is used (via
|
|
40
|
+
* `date-fns` `differenceInSeconds`), so differences across days are
|
|
41
|
+
* included. Fractional seconds are truncated.
|
|
41
42
|
* - **Any `string` input (or a mix of `Date` and `string`)** — only the time
|
|
42
|
-
* of day is compared
|
|
43
|
-
*
|
|
44
|
-
* hours/minutes/seconds are used.
|
|
43
|
+
* of day is compared. The calendar date of any `Date` is ignored, and its
|
|
44
|
+
* local hours/minutes/seconds are used.
|
|
45
45
|
*
|
|
46
46
|
* The time-of-day result is **not** wrapped around midnight: `"22:00"` →
|
|
47
47
|
* `"02:00"` gives `72000` (the gap between the two times of day), not the
|
|
@@ -50,9 +50,8 @@ function toSeconds(input) {
|
|
|
50
50
|
*
|
|
51
51
|
* @param start - The start time: a `Date` or an `HH:MM` (24-hour) string.
|
|
52
52
|
* @param end - The end time: a `Date` or an `HH:MM` (24-hour) string.
|
|
53
|
-
* @returns
|
|
54
|
-
*
|
|
55
|
-
* of day (never negative).
|
|
53
|
+
* @returns The absolute number of seconds between `start` and `end`
|
|
54
|
+
* (never negative).
|
|
56
55
|
* @throws {Error} If a string input is not in `HH:MM` format, or a `Date`
|
|
57
56
|
* input is invalid (in the time-of-day comparison path).
|
|
58
57
|
*
|
|
@@ -60,7 +59,7 @@ function toSeconds(input) {
|
|
|
60
59
|
* calculateTimeDifferenceInSeconds("09:00", "17:30"); // 30600
|
|
61
60
|
*
|
|
62
61
|
* @example
|
|
63
|
-
* // Order does not matter
|
|
62
|
+
* // Order does not matter
|
|
64
63
|
* calculateTimeDifferenceInSeconds("18:00", "09:00"); // 32400
|
|
65
64
|
*
|
|
66
65
|
* @example
|
|
@@ -76,7 +75,7 @@ function toSeconds(input) {
|
|
|
76
75
|
*/
|
|
77
76
|
function calculateTimeDifferenceInSeconds(start, end) {
|
|
78
77
|
if (start instanceof Date && end instanceof Date) {
|
|
79
|
-
return (0, date_fns_1.differenceInSeconds)(end, start);
|
|
78
|
+
return Math.abs((0, date_fns_1.differenceInSeconds)(end, start));
|
|
80
79
|
}
|
|
81
80
|
return Math.abs(toSeconds(end) - toSeconds(start));
|
|
82
81
|
}
|