This commit is contained in:
Peter Maquiran
2024-02-29 09:40:51 +01:00
parent fcc75eb8e2
commit b47154d313
56 changed files with 225 additions and 3383 deletions
+24 -3
View File
@@ -1,4 +1,5 @@
import { Injectable } from '@angular/core';
import { EventList } from '../models/agenda/AgendaEventList';
@Injectable({
providedIn: 'root'
@@ -9,7 +10,7 @@ export class DateService {
deferenceBetweenDays(start: any, end: any) {
const diffTime = Math.abs(end - start);
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
}
notSameDate(start: any, end: any): boolean {
@@ -25,12 +26,11 @@ export class DateService {
const endTimeSamp = new Date(endTime).toLocaleDateString()
const endMinutes = new Date(endTime).getMinutes()
const endHours = new Date(endTime).getHours()
const endHours = new Date(endTime).getHours()
if (startTimeSamp < endTimeSamp && (endMinutes + endHours) == 0) {
endTime = new Date(endTime);
endTime.setSeconds(endTime.getSeconds() - 1);
return new Date(endTime)
} else {
return new Date(endTime)
@@ -42,4 +42,25 @@ export class DateService {
getDay(date) {
return (((new Date (date)).getDate())).toString().padStart(2,'0')
}
fixDate(res: EventList) {
if(res.IsAllDayEvent && this.deferenceBetweenDays(new Date(res.StartDate), new Date(res.EndDate)) >= 1) {
const date = new Date(res.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`;
res.EndDate = formattedDate
console.log('reduze')
}
return res as any
}
}