Skip to content

Commit

Permalink
Merge pull request #246 from markalbrand56/angel
Browse files Browse the repository at this point in the history
arreglo de hora
  • Loading branch information
Diego2250 authored Nov 13, 2023
2 parents a418918 + 4079b81 commit 2a17b4f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
21 changes: 14 additions & 7 deletions uniEmpleos/src/components/InfoTab/InfoTab.jsx
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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 (
Expand All @@ -35,9 +42,9 @@ const InfoTab = ({
{salary && <p>{`Salario: ${salary}`}</p>}
{jornada && <p>{`Jornada: ${jornada}`}</p>}
{horarioinicio && horariofin && (
<p>{`Horario: ${`${parseTime(horarioinicio)}AM - ${parseTime(
<p>{`Horario: ${`${parseTime(horarioinicio)} - ${parseTime(
horariofin
)}PM`}`}</p>
)}`}`}</p>
)}
</div>
<div className={styles.button}>
Expand Down
1 change: 1 addition & 0 deletions uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const PrincipalStudent = () => {
}
}, [dataa.data, carrera, postulaciones])

console.log('-->', ofertasAMostrar)
return (
<div className={styles.container}>
<Header userperson="student" />
Expand Down
5 changes: 3 additions & 2 deletions uniEmpleos/src/pages/postulacion/Postulacion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -130,7 +131,7 @@ const Postulacion = ({ id }) => {
<Button
label="Postularme"
backgroundColor="#a08ae5"
onClick={handlePostularme}
onClick={() => {handlePostularme()}}
noborder
/>
</div>
Expand Down

0 comments on commit 2a17b4f

Please sign in to comment.