|
|
|
@ -46,7 +46,8 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
this.config.dateList.push({
|
|
|
|
|
literal: '',
|
|
|
|
|
date_object: new Date(),
|
|
|
|
|
timeList: []});
|
|
|
|
|
timeList: []
|
|
|
|
|
});
|
|
|
|
|
let selector = '[ng-reflect-name="dateChoices_' + (this.config.dateList.length - 1) + '"]';
|
|
|
|
|
this.cd.detectChanges();
|
|
|
|
|
const elem = this.document.querySelector(selector);
|
|
|
|
@ -59,7 +60,13 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
* change time spans
|
|
|
|
|
*/
|
|
|
|
|
addTime() {
|
|
|
|
|
this.config.timeList.push({literal: '', timeList: []});
|
|
|
|
|
this.config.timeList.push(
|
|
|
|
|
{
|
|
|
|
|
literal: '',
|
|
|
|
|
timeList: [],
|
|
|
|
|
date_object: new Date()
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeAllTimes() {
|
|
|
|
@ -103,6 +110,7 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
emptyAll() {
|
|
|
|
|
this.config.dateList.forEach(element => {
|
|
|
|
|
element.literal = '';
|
|
|
|
|
element.date_object = new Date();
|
|
|
|
|
element.timeList = ['', '', ''];
|
|
|
|
|
});
|
|
|
|
|
this.config.timeList.forEach(element => {
|
|
|
|
@ -110,6 +118,7 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* add all the dates between the start and end dates in the interval section
|
|
|
|
|
*/
|
|
|
|
@ -118,7 +127,11 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
const converted = [];
|
|
|
|
|
newIntervalArray.forEach(element => {
|
|
|
|
|
converted.push({literal: element, timeList: []});
|
|
|
|
|
converted.push({
|
|
|
|
|
literal: element.literal,
|
|
|
|
|
date_object: element.date_object,
|
|
|
|
|
timeList: []
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
this.config.dateList = [...new Set(converted)]; // add only dates that are not already present with a Set of unique items
|
|
|
|
|
this.showDateInterval = false;
|
|
|
|
@ -142,10 +155,13 @@ export class DatesComponent extends BaseComponent implements OnInit {
|
|
|
|
|
d2 = new Date(d2);
|
|
|
|
|
const dates = [];
|
|
|
|
|
while (+d1 < +d2) {
|
|
|
|
|
dates.push(this.formateDate(d1));
|
|
|
|
|
dates.push({
|
|
|
|
|
literal: this.formateDate(d1),
|
|
|
|
|
date_object: d1
|
|
|
|
|
});
|
|
|
|
|
d1.setDate(d1.getDate() + interval)
|
|
|
|
|
}
|
|
|
|
|
return dates.slice(0)
|
|
|
|
|
return dates.slice(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|