@dataloop-ai/components 0.18.120 → 0.18.122
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
CHANGED
|
@@ -112,19 +112,25 @@ export function replaceJSDatesWithStringifiedDates(
|
|
|
112
112
|
const toReturn = cloneDeep(json)
|
|
113
113
|
|
|
114
114
|
for (const key of Object.keys(toReturn)) {
|
|
115
|
-
if (typeof toReturn[key] === 'object') {
|
|
116
|
-
toReturn[key] = replaceJSDatesWithStringifiedDates(
|
|
117
|
-
toReturn[key],
|
|
118
|
-
dateKeys
|
|
119
|
-
)
|
|
120
|
-
continue
|
|
121
|
-
}
|
|
122
|
-
|
|
123
115
|
const value = toReturn[key]
|
|
124
116
|
const keyToCheck = key.split('.').pop()
|
|
125
117
|
|
|
126
118
|
if (dateKeys.includes(keyToCheck)) {
|
|
127
|
-
|
|
119
|
+
if (typeof value === 'object') {
|
|
120
|
+
const testKey = Object.keys(toReturn[key])[0]
|
|
121
|
+
if (['$gt', '$gte', '$lt', '$lte'].includes(testKey)) {
|
|
122
|
+
toReturn[key][testKey] = formatToStringDate(
|
|
123
|
+
toReturn[key][testKey]
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
toReturn[key] = formatToStringDate(value)
|
|
128
|
+
}
|
|
129
|
+
} else if (typeof value === 'object') {
|
|
130
|
+
toReturn[key] = replaceJSDatesWithStringifiedDates(
|
|
131
|
+
toReturn[key],
|
|
132
|
+
dateKeys
|
|
133
|
+
)
|
|
128
134
|
}
|
|
129
135
|
}
|
|
130
136
|
|