Skip to content

Commit f7863a4

Browse files
author
yaroslav8765
committed
fix: Fix mongoDB date format in db (from string to ISODate)
1 parent 3e7b08a commit f7863a4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

adminforth/dataConnectors/mongo.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,8 @@ class MongoConnector extends AdminForthBaseConnector implements IAdminForthDataS
194194
if (!value) {
195195
return null;
196196
}
197-
if (field._underlineType == 'timestamp' || field._underlineType == 'int') {
198-
// value is iso string now, convert to unix timestamp
199-
return dayjs(value).unix();
200-
} else if (field._underlineType == 'varchar') {
201-
// value is iso string now, convert to unix timestamp
202-
return dayjs(value).toISOString();
203-
}
197+
return dayjs(value).toDate();
198+
204199
} else if (field.type == AdminForthDataTypes.BOOLEAN) {
205200
return value === null ? null : (value ? true : false);
206201
} else if (field.type == AdminForthDataTypes.DECIMAL) {

0 commit comments

Comments
 (0)