Skip to content

Commit a6f5734

Browse files
committed
fix(api-console): serialize date correctly
1 parent 5de22c8 commit a6f5734

File tree

1 file changed

+9
-7
lines changed
  • packages/api-console-gui/src/app

1 file changed

+9
-7
lines changed

packages/api-console-gui/src/app/store.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,8 @@ export class DataStructure {
3838
}
3939

4040
export function extractDataStructure(ds: DataStructure, type: Type): any {
41-
if (type.kind === ReflectionKind.class || type.kind === ReflectionKind.objectLiteral) {
42-
if ((isReferenceType(type) || isBackReferenceType(type)) && ds.asReference) {
43-
const primary = ReflectionClass.from(type).getPrimary();
44-
return extractDataStructure(ds.properties[primary.name], primary.type);
45-
}
46-
47-
return extractDataStructureFromSchema(ds, ReflectionClass.from(type));
41+
if (type.kind === ReflectionKind.class && type.classType === Date) {
42+
return ds.value;
4843
} else if (isMapType(type)) {
4944
const v: any = {};
5045
if (!type.typeArguments) return;
@@ -76,6 +71,13 @@ export function extractDataStructure(ds: DataStructure, type: Type): any {
7671
}
7772

7873
return list;
74+
} else if (type.kind === ReflectionKind.class || type.kind === ReflectionKind.objectLiteral) {
75+
if ((isReferenceType(type) || isBackReferenceType(type)) && ds.asReference) {
76+
const primary = ReflectionClass.from(type).getPrimary();
77+
return extractDataStructure(ds.properties[primary.name], primary.type);
78+
}
79+
80+
return extractDataStructureFromSchema(ds, ReflectionClass.from(type));
7981
} else {
8082
return ds.value;
8183
}

0 commit comments

Comments
 (0)