mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user