Commit f5cb64e9 by Joel Florentin

se agrego unidad de tiempo(mes y year) de experiencia en listado postulante

parent 19ea8a2d
......@@ -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) {
......
<%@ 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 @@
<td>${postulante.nombre} ${postulante.apellido}</td>
<td>${postulante.disponibilidad.getDescripcion()}</td>
<td>${postulante.nivelIngles}</td>
<td>${postulante.experienciaMeses}<op></td>
<td><c:choose>
<c:when test = "${postulante.experienciaMeses < 12}">
${postulante.experienciaMeses} mes<c:if test="${postulante.experienciaMeses > 1}">es</c:if>
</c:when>
<c:when test = "${postulante.experienciaMeses > 12}">
<fmt:parseNumber var="j" integerOnly="true" type="number" value="${postulante.experienciaMeses / 12}" />
<fmt:parseNumber var="k" integerOnly="true" type="number" value="${postulante.experienciaMeses % 12}" />
${j} año<c:if test="${postulante.experienciaMeses >= 24}">s</c:if> <c:if test="${k > 0}"> y ${k} mes<c:if test="${k > 1}">es</c:if></c:if>
</c:when>
</c:choose>
</td>
<td>
<c:forEach items="${postulante.tecnologias}" var="detalle_tecnologia" varStatus="staTec">
${detalle_tecnologia.getTecnologia().getNombre()}${not staTec.last ? "," : ""}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment