-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtareas.js
More file actions
24 lines (21 loc) · 737 Bytes
/
Copy pathtareas.js
File metadata and controls
24 lines (21 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Modelo de Tarea
class Tarea {
constructor(id, nombre, descripcion, fechaLimite, modalidad) {
this.id = id;
this.nombre = nombre;
this.descripcion = descripcion;
this.fechaLimite = this.validarFecha(fechaLimite);
this.modalidad = modalidad;
}
validarFecha(fecha) {
const fechaValida = new Date(fecha);
if (isNaN(fechaValida.getTime())) {
throw new Error(`Fecha límite inválida: ${fecha}`);
}
return fechaValida;
}
obtenerResumen() {
return `Tarea: ${this.nombre}, Descripción: ${this.descripcion}, Fecha Límite: ${this.fechaLimite.toLocaleDateString()}, Modalidad: ${this.modalidad}`;
}
}
module.exports = Tarea;