From f5cb64e98fe0016b9dac44a55626e347310233b6 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 22 Nov 2021 17:11:30 -0300 Subject: [PATCH] se agrego unidad de tiempo(mes y year) de experiencia en listado postulante --- curriculumsearch/src/main/java/com/roshka/utils/Helper.java | 13 ++++++++++--- curriculumsearch/src/main/webapp/jsp/postulantes.jsp | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/curriculumsearch/src/main/java/com/roshka/utils/Helper.java b/curriculumsearch/src/main/java/com/roshka/utils/Helper.java index 18adb78..189aa82 100644 --- a/curriculumsearch/src/main/java/com/roshka/utils/Helper.java +++ b/curriculumsearch/src/main/java/com/roshka/utils/Helper.java @@ -7,6 +7,7 @@ import java.time.YearMonth; import java.time.ZoneOffset; import java.time.temporal.ChronoUnit; import java.util.Date; +import java.util.concurrent.TimeUnit; import com.roshka.modelo.DBFile; @@ -31,12 +32,18 @@ public class Helper { } } + /** + * Diferencia en meses entre 2 fechas. + * @param date1 La fecha inicial. No puede ser nulo + * @param date2 La fecha final. Si es nulo, se asume a la fecha de hoy + * @return + */ public static final long getMonthsDifference(Date date1, Date date2) { if(date2==null) date2 = new Date(); - YearMonth m1 = YearMonth.from(date1.toInstant().atZone(ZoneOffset.UTC)); - YearMonth m2 = YearMonth.from(date2.toInstant().atZone(ZoneOffset.UTC)); + long diffInMillies = Math.abs(date2.getTime() - date1.getTime()); + long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); - return m1.until(m2, ChronoUnit.MONTHS) + 1; + return Math.round(diff/30.d) ; } public static DBFile createFile(MultipartFile file) { diff --git a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp index 3de212c..40b2cb1 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp @@ -1,4 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> @@ -190,7 +191,20 @@ ${postulante.nombre} ${postulante.apellido} ${postulante.disponibilidad.getDescripcion()} ${postulante.nivelIngles} - ${postulante.experienciaMeses} + + + + ${postulante.experienciaMeses} meses + + + + + + ${j} años y ${k} meses + + + + ${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""} -- libgit2 0.26.0