File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -579,12 +579,7 @@ export class ObjectSerializer {
579579 if ( data == undefined ) {
580580 return data ;
581581 } else if ( primitives . indexOf ( type . toLowerCase ( ) ) !== - 1 ) {
582- if ( type === "string" && data . toString ( ) . substring ( 0 , 6 ) === "/Date(" ) {
583- return this . deserializeDateFormats ( type , data ) // For MS dates that are of type 'string'
584- }
585- else {
586- return data ;
587- }
582+ return data ;
588583 } else if ( type . lastIndexOf ( "Array<" , 0 ) === 0 ) { // string.startsWith pre es6
589584 let subType : string = type . replace ( "Array<" , "" ) ; // Array<Type> => Type>
590585 subType = subType . substring ( 0 , subType . length - 1 ) ; // Type> => Type
Original file line number Diff line number Diff line change 1+ import { ObjectSerializer } from '../gen/model/accounting/models' ;
2+
3+ describe ( 'ObjectSerializer' , ( ) => {
4+ it ( 'preserves invoice date fields as strings during deserialization' , ( ) => {
5+ const invoice = ObjectSerializer . deserialize (
6+ {
7+ Date : '/Date(1743638400000+0000)/' ,
8+ DueDate : '/Date(1743724800000+0000)/' ,
9+ } ,
10+ 'Invoice' ,
11+ ) ;
12+
13+ expect ( invoice . date ) . toBe ( '/Date(1743638400000+0000)/' ) ;
14+ expect ( invoice . dueDate ) . toBe ( '/Date(1743724800000+0000)/' ) ;
15+ } ) ;
16+ } ) ;
You can’t perform that action at this time.
0 commit comments