-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchedule.js
38 lines (33 loc) · 915 Bytes
/
Schedule.js
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
// ID
// Nombre de asignatura
// Fecha-Hora inicio
// Fecha-Hora final
// -> duracion/tiempo restante
function create(id, name, initDate, endDate) {
var item = new Object();
item.id = id;
item.name = name;
item.initDate = initDate;
item.endDate = endDate;
item.duration = function () {
timeNow = new Date();
//Recoge la hora actual del sistema en formato hh:mm
let timeNowFormat = timeNow.toLocaleTimeString("default", {
hour: "2-digit",
minute: "2-digit",
});
let timeRestant = minutesDif(endTime, timeNowFormat);
let signatureTotal = minutesDif(endTime, startTime);
console.log(
timeRestant +
"\n" +
signatureTotal +
"\n" +
"Porcentaje: " +
((signatureTotal - timeRestant) * 100) / signatureTotal +
"%"
);
return ((signatureTotal - timeRestant) * 100) / signatureTotal;
};
return item;
}