@tap-payments/os-micro-frontend-shared 0.1.374 → 0.1.375
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/build/utils/date.js +5 -3
- package/package.json +1 -1
package/build/utils/date.js
CHANGED
|
@@ -69,9 +69,11 @@ export const formatUTCOffset = (offset = 0) => {
|
|
|
69
69
|
* @returns - Array of two dates [startDate, endDate]
|
|
70
70
|
*/
|
|
71
71
|
export const getDefaultDateRange = (startDay = 6) => {
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
72
|
+
const safeDays = Number.isFinite(startDay) && startDay >= 0 ? startDay : 0;
|
|
73
|
+
const now = dayjs();
|
|
74
|
+
const start = now.subtract(safeDays, 'day').startOf('day');
|
|
75
|
+
const end = now.endOf('day');
|
|
76
|
+
return [start.toDate(), end.toDate()];
|
|
75
77
|
};
|
|
76
78
|
export const getUTCTimestamp = (date) => {
|
|
77
79
|
// Create a Date object with the local date string
|
package/package.json
CHANGED