Fix data rozpoczęcia testu w grupie

This commit is contained in:
Marcin Szczepański 2020-01-23 21:37:39 +01:00
parent eeef8c49f6
commit 4b87bf216c
2 changed files with 12 additions and 4 deletions

View File

@ -86,7 +86,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
let dateFrom = null;
let dateTo = null;
if (this.dateFrom) {
dateFrom = this.dateFrom.getTime();
dateFrom = this.dateFrom.getTime() - this.dateFrom.getSeconds() * 1000 - this.dateFrom.getMilliseconds();
dateTo = dateFrom + this.howLong * 60 * 1000;
}
this.groupService.putTestsToGroup(this.id, [this.testId.toString()], dateFrom, dateTo).subscribe(
@ -339,7 +339,11 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
const tempstop = new Date(x['dateTo']);
x['startDate'] = '';
const hours = temp.getHours();
const minutes = temp.getMinutes();
const minutesTemp = temp.getMinutes();
let minutes = minutesTemp.toString();
if (minutesTemp < 10) {
minutes = `0${minutesTemp}`;
}
// const months = ['STY', 'LUT', 'MAR', 'KWI', 'MAJ', 'CZE', 'LIP', 'SIE', 'WRZ', 'PAŹ', 'LIS', 'GRU'];
const year = temp.getFullYear().toString().substring(2);
const monthTemp = (temp.getMonth() + 1);
@ -347,7 +351,11 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
if (monthTemp < 10) {
month = `0${monthTemp}`;
}
const date = temp.getDate();
const dateTemp = temp.getDate();
let date = dateTemp.toString();
if (dateTemp < 10) {
date = `0${dateTemp}`;
}
const time = date + '.' + month + '.' + year + ' ' + hours + ':' + minutes;
x['startDate'] += time;
});

View File

@ -165,7 +165,7 @@ export class SharingResourcesInGroupsComponent implements OnInit, OnDestroy {
let dateFrom = null;
let dateTo = null;
if (this.dateFrom) {
dateFrom = this.dateFrom.getTime();
dateFrom = this.dateFrom.getTime() - this.dateFrom.getSeconds() * 1000 - this.dateFrom.getMilliseconds();
dateTo = dateFrom + this.howLong * 60 * 1000;
}
this.addTestsToGroupSub = this.groupService.addTestsToGroup(this.id, this.selected, dateFrom, dateTo).subscribe(