Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x 1x 12x 12x 10x 10x 10x 10x 19x 19x 10x 10x 19x 10x 2x | import { CodigoFormatoFecha, FormatoFeriados } from "../constants"
import { validarFecha } from "./validarfecha";
import { addDias } from "./proximafecha";
import { isHabil } from "./diahabil";
/**
*
* @param fecha
* @param feriados
* Obtiene la próxima fecha hábil dados una fecha y el listado de feriados de su país
*/
export function getDiaHabilSiguiente(fecha: string, listaFeriados: FormatoFeriados[]): string {
try {
validarFecha(fecha);
let diaHabilSiguiente: string = '';
let habil:boolean = false;
let sgteDia: number = 1;
while(!habil){
let siguienteFecha = addDias(fecha, sgteDia);
if (isHabil(siguienteFecha, listaFeriados)){
diaHabilSiguiente = siguienteFecha;
habil = true;
}
sgteDia += 1;
}
return diaHabilSiguiente;
} catch (error) {
throw new Error(error);
}
} |