From e8cf1f75d81f4e439a6d34b638bee8c4f7290717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:58:16 -0600 Subject: [PATCH 1/2] arreglo de hora Se corrigio la hora de las ofertas laborales --- uniEmpleos/src/components/InfoTab/InfoTab.jsx | 21 ++++++++++++------- .../PrincipalStudent/PrincipalStudent.jsx | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/uniEmpleos/src/components/InfoTab/InfoTab.jsx b/uniEmpleos/src/components/InfoTab/InfoTab.jsx index 54cf1b09..44237fe2 100644 --- a/uniEmpleos/src/components/InfoTab/InfoTab.jsx +++ b/uniEmpleos/src/components/InfoTab/InfoTab.jsx @@ -1,6 +1,6 @@ import React from "react" import PropTypes from "prop-types" -import { format } from "date-fns-tz" +import { format } from "date-fns" import styles from "./InfoTab.module.css" import Button from "../Button/Button" @@ -16,11 +16,18 @@ const InfoTab = ({ horariofin, jornada, }) => { - console.log(horarioinicio) - console.log(horariofin) - const parseTime = (isoString) => { - return isoString.split("T")[1].split("Z")[0].slice(0, -3) + const date = isoString.split("T")[1].split("Z")[0].slice(0, -3) + const hours = parseInt(date.split(":")[0]) + if (hours > 12) { + return `${hours - 12}:${date.split(":")[1]} p.m.` + } else if (hours === 12) { + return `12:${date.split(":")[1]} p.m.` + } else if (hours === 0) { + return `12:${date.split(":")[1]} a.m.` + } else { + return `${hours}:${date.split(":")[1]} a.m.` + } } return ( @@ -35,9 +42,9 @@ const InfoTab = ({ {salary &&

{`Salario: ${salary}`}

} {jornada &&

{`Jornada: ${jornada}`}

} {horarioinicio && horariofin && ( -

{`Horario: ${`${parseTime(horarioinicio)}AM - ${parseTime( +

{`Horario: ${`${parseTime(horarioinicio)} - ${parseTime( horariofin - )}PM`}`}

+ )}`}`}

)}
diff --git a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx index 8ee8028d..d9e3fdfa 100644 --- a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx +++ b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx @@ -104,6 +104,7 @@ const PrincipalStudent = () => { } }, [dataa.data, carrera, postulaciones]) + console.log('-->', ofertasAMostrar) return (
From 4079b810d7255a4d2ccdf6a0733f8835752e341f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:13:41 -0600 Subject: [PATCH 2/2] arreglo de bug visual se corrigio el bug que hacia que luego de postularse a una oferta laboral se pusiera en blanco la pagina --- uniEmpleos/src/pages/postulacion/Postulacion.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uniEmpleos/src/pages/postulacion/Postulacion.jsx b/uniEmpleos/src/pages/postulacion/Postulacion.jsx index b6c44be7..5d871772 100644 --- a/uniEmpleos/src/pages/postulacion/Postulacion.jsx +++ b/uniEmpleos/src/pages/postulacion/Postulacion.jsx @@ -12,6 +12,7 @@ import Popup from "../../components/Popup/Popup" const Postulacion = ({ id }) => { const { user } = useStoreon("user") const api = useApi() + const apiPostulation = useApi() const { quill, quillRef } = useQuill({ readOnly: true, // Establecer el editor Quill en modo de solo lectura modules: { @@ -46,7 +47,7 @@ const Postulacion = ({ id }) => { }, [quill, detalles]) const handlePostularme = async () => { - const apiResponse = await api.handleRequest("POST", "/postulations/", { + const apiResponse = await apiPostulation.handleRequest("POST", "/postulations/", { id_oferta: parseInt(id, 10), id_estudiante: user.id_user, estado: "enviada", @@ -130,7 +131,7 @@ const Postulacion = ({ id }) => {