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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 1x 1x 1x 758x 758x 757x 336x 336x 67x 67x 43x 43x 43x 43x 54x 54x 54x 54x 257x 257x 257x 257x 757x 1x | import { CodigoFormatoFecha } from "../constants";
import { getFormatoFecha } from "./getformatofecha";
/**
*
* @param fecha
* Obtiene de una fecha valida dada, año, mes y dia por separados
*/
export function disgregarFecha(fecha:string): any{
/* all formattes */
try {
const formato = getFormatoFecha(fecha);
let dia, mes, anio;
switch (formato){
case CodigoFormatoFecha.FMT_ESPANOL:
/* dd/mm/yyyy */
[dia, mes, anio] = fecha.split('/');
break;
case CodigoFormatoFecha.FMT_ITALIANO:
/* dd-mm-yyyy*/
[dia, mes, anio] = fecha.split('-');
break;
case CodigoFormatoFecha.FMT_PLANO:
/* ddmmyyyy*/
dia = fecha.substr(0, 2);
mes = fecha.substr(2, 2);
anio = fecha.substr(4, 4);
break;
case CodigoFormatoFecha.FMT_INVERSOPLANO:
/* yyyymmdd */
anio = fecha.substr(0, 4);
mes = fecha.substr(4, 2);
dia = fecha.substr(6, 2);
break;
case CodigoFormatoFecha.FMT_INVERSO:
/* yyyy/mm/dd ej: 2020/09/16*/
anio = fecha.substr(0, 4);
mes = fecha.substr(5, 2);
dia = fecha.substr(8, 2);
break;
}
return { dia: dia, mes: mes, anio: anio }
} catch (error) {
throw (error);
}
}
|