diff --git a/src/prestamo/prestamo.service.ts b/src/prestamo/prestamo.service.ts index 0a7854a..c441966 100644 --- a/src/prestamo/prestamo.service.ts +++ b/src/prestamo/prestamo.service.ts @@ -163,6 +163,9 @@ export class PrestamoService { id_tipo_entrada?: number, ): Promise { const ahora = moment(); + + if (this.add) ahora.add(this.add, 'h'); + const ahoraStr = ahora.format('YYYY-MM-DD'); const modulo = await this.moduloService.findFullInfoById(id_modulo); const tipoCarrito = @@ -190,7 +193,6 @@ export class PrestamoService { ) : null; - if (this.add) ahora.add(this.add, 'h'); // Validamos que el id_institucion_usuario le pertenezca al usuario if (institucionUsuario.usuario.id_usuario != usuario.id_usuario) throw new ConflictException('No te pertenece esta información.'); @@ -288,6 +290,9 @@ export class PrestamoService { id_prestamo: number | Prestamo, ): Promise { const ahora = moment(); + + if (this.add) ahora.add(this.add, 'h'); + const ahoraStr = ahora.format('YYYY-MM-DD'); const prestamo = typeof id_prestamo === 'number' @@ -303,7 +308,6 @@ export class PrestamoService { ? moment(`${ahoraStr} ${institucionDia.hora_fin}`) : null; - if (this.add) ahora.add(this.add, 'h'); if ( prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito != 4 && prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito != 5