av6-core 1.7.4 → 1.7.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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -533,7 +533,7 @@ declare const getPattern: {
|
|
|
533
533
|
};
|
|
534
534
|
declare const interpolate: (template: string, vars: Record<string, unknown>) => string;
|
|
535
535
|
declare const fromTimestampToSqlDatetime: (date: string) => string;
|
|
536
|
-
declare function formatDatesDeep(data:
|
|
536
|
+
declare function formatDatesDeep<T>(data: T, format?: string): T;
|
|
537
537
|
|
|
538
538
|
interface CreateTransaction {
|
|
539
539
|
field: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -533,7 +533,7 @@ declare const getPattern: {
|
|
|
533
533
|
};
|
|
534
534
|
declare const interpolate: (template: string, vars: Record<string, unknown>) => string;
|
|
535
535
|
declare const fromTimestampToSqlDatetime: (date: string) => string;
|
|
536
|
-
declare function formatDatesDeep(data:
|
|
536
|
+
declare function formatDatesDeep<T>(data: T, format?: string): T;
|
|
537
537
|
|
|
538
538
|
interface CreateTransaction {
|
|
539
539
|
field: string;
|
package/dist/index.js
CHANGED
|
@@ -1446,9 +1446,9 @@ function formatDatesDeep(data, format = "YYYY-MM-DD") {
|
|
|
1446
1446
|
const result = {};
|
|
1447
1447
|
for (const key in data) {
|
|
1448
1448
|
const value = data[key];
|
|
1449
|
-
if (value instanceof Date || (0, import_dayjs.default)(value).isValid()) {
|
|
1449
|
+
if (value instanceof Date || typeof value === "string" && (0, import_dayjs.default)(value, "YYYY-MM-DD", true).isValid()) {
|
|
1450
1450
|
result[key] = (0, import_dayjs.default)(value).format(format);
|
|
1451
|
-
} else if (Array.isArray(value) || typeof value === "object") {
|
|
1451
|
+
} else if (Array.isArray(value) || typeof value === "object" && value !== null) {
|
|
1452
1452
|
result[key] = formatDatesDeep(value, format);
|
|
1453
1453
|
} else {
|
|
1454
1454
|
result[key] = value;
|
package/dist/index.mjs
CHANGED
|
@@ -1394,9 +1394,9 @@ function formatDatesDeep(data, format = "YYYY-MM-DD") {
|
|
|
1394
1394
|
const result = {};
|
|
1395
1395
|
for (const key in data) {
|
|
1396
1396
|
const value = data[key];
|
|
1397
|
-
if (value instanceof Date || dayjs(value).isValid()) {
|
|
1397
|
+
if (value instanceof Date || typeof value === "string" && dayjs(value, "YYYY-MM-DD", true).isValid()) {
|
|
1398
1398
|
result[key] = dayjs(value).format(format);
|
|
1399
|
-
} else if (Array.isArray(value) || typeof value === "object") {
|
|
1399
|
+
} else if (Array.isArray(value) || typeof value === "object" && value !== null) {
|
|
1400
1400
|
result[key] = formatDatesDeep(value, format);
|
|
1401
1401
|
} else {
|
|
1402
1402
|
result[key] = value;
|