I’m encountering an issue when trying to insert a time value into a field defined as startTime in my entity in PostgreSQL. Here’s the relevant code:
@Property({ type: 'time' })
startTime!: Date;
And in my service function:
await this.persistAndFlush(context, shiftType, {
name: input.name,
startTime: new Date('12:22:00'),
endTime: new Date('12:22:00'),
status: activeStatus,
});
I need to save only the time portion, but when I attempt this insertion, I get the error:
"type":"DriverException","message":"Invalid time value","stack":"DriverException: Invalid time valuen at PostgreSqlExceptionConverter.convertException
When I add the value directly through the pgAdmin, It accepts the format correctly.
How can I resolve this issue and successfully insert only the time value into the startTime field?
Thanks!