mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Event, EventToApproveEdit } from '../models/event.model';
|
||||
import { Event, EventToApproveEdit, } from '../models/event.model';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
@@ -626,6 +626,11 @@ export class EventsService {
|
||||
}
|
||||
|
||||
|
||||
private deferenceBetweenDays(start: any, end: any) {
|
||||
const diffTime = Math.abs(end - start);
|
||||
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
|
||||
async getEventsByCalendarId( startdate: string, enddate: string, calendarId: any) {
|
||||
const calendars = SessionStore.user.OwnerCalendars.concat(SessionStore.user.SharedCalendars)
|
||||
const agendasCalendars = calendars.filter( e => e.CalendarId == calendarId)
|
||||
@@ -652,7 +657,30 @@ export class EventsService {
|
||||
params: params
|
||||
};
|
||||
|
||||
const calendar = await this.http.get<Event[]>(`${geturl}`, options).toPromise()
|
||||
let calendar = await this.http.get<EventList[]>(`${geturl}`, options).toPromise()
|
||||
|
||||
calendar = calendar.map(e => {
|
||||
if(e.IsAllDayEvent && this.deferenceBetweenDays(new Date(e.StartDate), new Date(e.EndDate)) >= 1) {
|
||||
|
||||
const date = new Date(e.EndDate);
|
||||
|
||||
date.setDate(date.getDate() -1);
|
||||
|
||||
const _date = date.getDate();
|
||||
const month = date.getMonth() + 1;
|
||||
const fullYear = date.getFullYear();
|
||||
const formattedDate = `${fullYear}-${month}-${_date} 23:59`;
|
||||
e.EndDate = formattedDate
|
||||
|
||||
console.log('reduze')
|
||||
|
||||
}
|
||||
|
||||
return e
|
||||
})
|
||||
|
||||
console.log({calendar})
|
||||
|
||||
|
||||
result = result.concat(calendar)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user