@onivoro/isomorphic-common 24.33.4 → 24.33.5
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/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/lib/functions/to-end-of-day.function.d.ts +17 -0
- package/src/lib/functions/to-end-of-day.function.js +28 -0
- package/src/lib/functions/to-end-of-day.function.js.map +1 -0
- package/src/lib/functions/to-start-of-day.function.d.ts +17 -0
- package/src/lib/functions/to-start-of-day.function.js +28 -0
- package/src/lib/functions/to-start-of-day.function.js.map +1 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ export * from './lib/functions/to-calendar-date.function';
|
|
|
63
63
|
export * from './lib/functions/to-csv-string.function';
|
|
64
64
|
export * from './lib/functions/to-decimal-base.function';
|
|
65
65
|
export * from './lib/functions/to-dollars-and-cents.function';
|
|
66
|
+
export * from './lib/functions/to-end-of-day.function';
|
|
67
|
+
export * from './lib/functions/to-start-of-day.function';
|
|
66
68
|
export * from './lib/functions/to-unique-array.function';
|
|
67
69
|
export * from './lib/functions/to-words.function';
|
|
68
70
|
export * from './lib/functions/try-json-parse';
|
package/src/index.js
CHANGED
|
@@ -66,6 +66,8 @@ tslib_1.__exportStar(require("./lib/functions/to-calendar-date.function"), expor
|
|
|
66
66
|
tslib_1.__exportStar(require("./lib/functions/to-csv-string.function"), exports);
|
|
67
67
|
tslib_1.__exportStar(require("./lib/functions/to-decimal-base.function"), exports);
|
|
68
68
|
tslib_1.__exportStar(require("./lib/functions/to-dollars-and-cents.function"), exports);
|
|
69
|
+
tslib_1.__exportStar(require("./lib/functions/to-end-of-day.function"), exports);
|
|
70
|
+
tslib_1.__exportStar(require("./lib/functions/to-start-of-day.function"), exports);
|
|
69
71
|
tslib_1.__exportStar(require("./lib/functions/to-unique-array.function"), exports);
|
|
70
72
|
tslib_1.__exportStar(require("./lib/functions/to-words.function"), exports);
|
|
71
73
|
tslib_1.__exportStar(require("./lib/functions/try-json-parse"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/isomorphic/common/src/index.ts"],"names":[],"mappings":";;;AAAA,iFAAuD;AACvD,kFAAwD;AACxD,2EAAiD;AAEjD,sFAA4D;AAC5D,8EAAoD;AAEpD,yEAA+C;AAC/C,8EAAoD;AACpD,uFAA6D;AAC7D,4FAAkE;AAClE,sFAA4D;AAC5D,iFAAuD;AACvD,2FAAiE;AACjE,+FAAqE;AACrE,4FAAkE;AAClE,uFAA6D;AAC7D,gFAAsD;AACtD,2FAAiE;AACjE,yEAA+C;AAC/C,0FAAgE;AAChE,0FAAgE;AAChE,sFAA4D;AAC5D,qFAA2D;AAC3D,8EAAoD;AACpD,gFAAsD;AACtD,gFAAsD;AACtD,8FAAoE;AACpE,4EAAkD;AAElD,6EAAmD;AACnD,sEAA4C;AAC5C,mEAAyC;AACzC,uEAA6C;AAC7C,oEAA0C;AAE1C,kFAAwD;AACxD,mFAAyD;AACzD,qFAA2D;AAC3D,2EAAiD;AAEjD,8EAAoD;AACpD,8EAAoD;AACpD,6FAAmE;AACnE,8EAAoD;AACpD,uFAA6D;AAC7D,sFAA4D;AAC5D,mFAAyD;AACzD,4FAAkE;AAClE,6EAAmD;AACnD,iFAAuD;AACvD,8EAAoD;AACpD,+FAAqE;AACrE,4FAAkE;AAClE,uFAA6D;AAC7D,yEAA+C;AAC/C,8EAAoD;AACpD,uFAA6D;AAC7D,sFAA4D;AAC5D,2FAAiE;AACjE,yEAA+C;AAC/C,yEAA+C;AAC/C,qFAA2D;AAC3D,8EAAoD;AACpD,mFAAyD;AACzD,qFAA2D;AAC3D,oFAA0D;AAC1D,iFAAuD;AACvD,mFAAyD;AACzD,wFAA8D;AAC9D,mFAAyD;AACzD,4EAAkD;AAClD,yEAA+C;AAC/C,6EAAmD;AACnD,kFAAwD;AACxD,8EAAoD;AACpD,+EAAqD;AACrD,yEAA+C;AAE/C,6FAAmE;AACnE,gFAAsD;AACtD,mEAAyC;AACzC,uEAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/isomorphic/common/src/index.ts"],"names":[],"mappings":";;;AAAA,iFAAuD;AACvD,kFAAwD;AACxD,2EAAiD;AAEjD,sFAA4D;AAC5D,8EAAoD;AAEpD,yEAA+C;AAC/C,8EAAoD;AACpD,uFAA6D;AAC7D,4FAAkE;AAClE,sFAA4D;AAC5D,iFAAuD;AACvD,2FAAiE;AACjE,+FAAqE;AACrE,4FAAkE;AAClE,uFAA6D;AAC7D,gFAAsD;AACtD,2FAAiE;AACjE,yEAA+C;AAC/C,0FAAgE;AAChE,0FAAgE;AAChE,sFAA4D;AAC5D,qFAA2D;AAC3D,8EAAoD;AACpD,gFAAsD;AACtD,gFAAsD;AACtD,8FAAoE;AACpE,4EAAkD;AAElD,6EAAmD;AACnD,sEAA4C;AAC5C,mEAAyC;AACzC,uEAA6C;AAC7C,oEAA0C;AAE1C,kFAAwD;AACxD,mFAAyD;AACzD,qFAA2D;AAC3D,2EAAiD;AAEjD,8EAAoD;AACpD,8EAAoD;AACpD,6FAAmE;AACnE,8EAAoD;AACpD,uFAA6D;AAC7D,sFAA4D;AAC5D,mFAAyD;AACzD,4FAAkE;AAClE,6EAAmD;AACnD,iFAAuD;AACvD,8EAAoD;AACpD,+FAAqE;AACrE,4FAAkE;AAClE,uFAA6D;AAC7D,yEAA+C;AAC/C,8EAAoD;AACpD,uFAA6D;AAC7D,sFAA4D;AAC5D,2FAAiE;AACjE,yEAA+C;AAC/C,yEAA+C;AAC/C,qFAA2D;AAC3D,8EAAoD;AACpD,mFAAyD;AACzD,qFAA2D;AAC3D,oFAA0D;AAC1D,iFAAuD;AACvD,mFAAyD;AACzD,wFAA8D;AAC9D,iFAAuD;AACvD,mFAAyD;AACzD,mFAAyD;AACzD,4EAAkD;AAClD,yEAA+C;AAC/C,6EAAmD;AACnD,kFAAwD;AACxD,8EAAoD;AACpD,+EAAqD;AACrD,yEAA+C;AAE/C,6FAAmE;AACnE,gFAAsD;AACtD,mEAAyC;AACzC,uEAA6C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a date string to a Date object representing the end of that day (23:59:59.999 UTC).
|
|
3
|
+
*
|
|
4
|
+
* If the input already includes a time component (contains 'T'), the original
|
|
5
|
+
* parsed date is returned unchanged.
|
|
6
|
+
*
|
|
7
|
+
* @param dateStr - A date string in YYYY-MM-DD format or ISO 8601 datetime format
|
|
8
|
+
* @returns A Date object set to the end of the day in UTC
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Date-only string - sets to end of day
|
|
12
|
+
* toEndOfDay('2023-01-15') // Returns Date for 2023-01-15T23:59:59.999Z
|
|
13
|
+
*
|
|
14
|
+
* // Datetime string - returns as-is
|
|
15
|
+
* toEndOfDay('2023-01-15T14:30:00Z') // Returns Date for 2023-01-15T14:30:00.000Z
|
|
16
|
+
*/
|
|
17
|
+
export declare function toEndOfDay(dateStr: string): Date;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toEndOfDay = toEndOfDay;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a date string to a Date object representing the end of that day (23:59:59.999 UTC).
|
|
6
|
+
*
|
|
7
|
+
* If the input already includes a time component (contains 'T'), the original
|
|
8
|
+
* parsed date is returned unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @param dateStr - A date string in YYYY-MM-DD format or ISO 8601 datetime format
|
|
11
|
+
* @returns A Date object set to the end of the day in UTC
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Date-only string - sets to end of day
|
|
15
|
+
* toEndOfDay('2023-01-15') // Returns Date for 2023-01-15T23:59:59.999Z
|
|
16
|
+
*
|
|
17
|
+
* // Datetime string - returns as-is
|
|
18
|
+
* toEndOfDay('2023-01-15T14:30:00Z') // Returns Date for 2023-01-15T14:30:00.000Z
|
|
19
|
+
*/
|
|
20
|
+
function toEndOfDay(dateStr) {
|
|
21
|
+
const date = new Date(dateStr);
|
|
22
|
+
// If it's just a date (no time component), set to end of day
|
|
23
|
+
if (!dateStr.includes('T')) {
|
|
24
|
+
date.setUTCHours(23, 59, 59, 999);
|
|
25
|
+
}
|
|
26
|
+
return date;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=to-end-of-day.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-end-of-day.function.js","sourceRoot":"","sources":["../../../../../../../libs/isomorphic/common/src/lib/functions/to-end-of-day.function.ts"],"names":[],"mappings":";;AAgBA,gCAOC;AAvBD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,UAAU,CAAC,OAAe;IACxC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,6DAA6D;IAC7D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a date string to a Date object representing the start of that day (00:00:00.000 UTC).
|
|
3
|
+
*
|
|
4
|
+
* If the input already includes a time component (contains 'T'), the original
|
|
5
|
+
* parsed date is returned unchanged.
|
|
6
|
+
*
|
|
7
|
+
* @param dateStr - A date string in YYYY-MM-DD format or ISO 8601 datetime format
|
|
8
|
+
* @returns A Date object set to the start of the day in UTC
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Date-only string - sets to start of day
|
|
12
|
+
* toStartOfDay('2023-01-15') // Returns Date for 2023-01-15T00:00:00.000Z
|
|
13
|
+
*
|
|
14
|
+
* // Datetime string - returns as-is
|
|
15
|
+
* toStartOfDay('2023-01-15T14:30:00Z') // Returns Date for 2023-01-15T14:30:00.000Z
|
|
16
|
+
*/
|
|
17
|
+
export declare function toStartOfDay(dateStr: string): Date;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toStartOfDay = toStartOfDay;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a date string to a Date object representing the start of that day (00:00:00.000 UTC).
|
|
6
|
+
*
|
|
7
|
+
* If the input already includes a time component (contains 'T'), the original
|
|
8
|
+
* parsed date is returned unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @param dateStr - A date string in YYYY-MM-DD format or ISO 8601 datetime format
|
|
11
|
+
* @returns A Date object set to the start of the day in UTC
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Date-only string - sets to start of day
|
|
15
|
+
* toStartOfDay('2023-01-15') // Returns Date for 2023-01-15T00:00:00.000Z
|
|
16
|
+
*
|
|
17
|
+
* // Datetime string - returns as-is
|
|
18
|
+
* toStartOfDay('2023-01-15T14:30:00Z') // Returns Date for 2023-01-15T14:30:00.000Z
|
|
19
|
+
*/
|
|
20
|
+
function toStartOfDay(dateStr) {
|
|
21
|
+
const date = new Date(dateStr);
|
|
22
|
+
// If it's just a date (no time component), set to start of day
|
|
23
|
+
if (!dateStr.includes('T')) {
|
|
24
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
25
|
+
}
|
|
26
|
+
return date;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=to-start-of-day.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-start-of-day.function.js","sourceRoot":"","sources":["../../../../../../../libs/isomorphic/common/src/lib/functions/to-start-of-day.function.ts"],"names":[],"mappings":";;AAgBA,oCAOC;AAvBD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,+DAA+D;IAC/D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|