Check if date is valid before calling toISOString()
This commit is contained in:
parent
91ecdbba10
commit
1e53f55cfa
@ -5,7 +5,7 @@ import {
|
||||
} from 'typeorm'
|
||||
|
||||
const transformer = {
|
||||
from: (value: Date) => value.toISOString(),
|
||||
from: (value: Date) => !isNaN(value.getTime()) ? value.toISOString() : value,
|
||||
to: (value: undefined | null | string) => value ? new Date(value) : value,
|
||||
}
|
||||
|
||||
|
||||
@ -62,8 +62,8 @@ describe('UserService', () => {
|
||||
id: jasmine.any(Number),
|
||||
userId: id,
|
||||
email: username,
|
||||
createDate: jasmine.any(Date),
|
||||
updateDate: jasmine.any(Date),
|
||||
createDate: jasmine.any(String),
|
||||
updateDate: jasmine.any(String),
|
||||
}])
|
||||
})
|
||||
})
|
||||
|
||||
@ -31,7 +31,7 @@ export class TeamService implements ITeamService {
|
||||
roleId: 1,
|
||||
})
|
||||
|
||||
return team
|
||||
return (await this.findOne(team.id))!
|
||||
}
|
||||
|
||||
async remove({id, userId}: {id: number, userId: number}) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user