mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix agenda
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<ion-refresher-content>
|
<ion-refresher-content>
|
||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
|
|
||||||
<div class="d-flex container-wrapper">
|
<div class="d-flex container-wrapper">
|
||||||
|
|
||||||
<div class="calendar-timeline d-flex flex-column height-100 bg-blue">
|
<div class="calendar-timeline d-flex flex-column height-100 bg-blue">
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- Toolbar -->
|
<!-- Toolbar -->
|
||||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||||
|
|
||||||
<div class="weeksToShow">
|
<div class="weeksToShow">
|
||||||
<!-- Calendar is here -->
|
<!-- Calendar is here -->
|
||||||
|
|
||||||
<div class="calendar-segment-{{profile}}" [class.calendar-segment-pr-force]="SessionStore.user.Profile =='PR'">
|
<div class="calendar-segment-{{profile}}" [class.calendar-segment-pr-force]="SessionStore.user.Profile =='PR'">
|
||||||
@@ -55,13 +55,13 @@
|
|||||||
class="select-calendar">
|
class="select-calendar">
|
||||||
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
|
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||||
<mat-select [(value)]="CalendarName" (selectionChange)="reloadCalendar()">
|
<mat-select [(value)]="CalendarName" (selectionChange)="reloadCalendar()">
|
||||||
|
|
||||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||||
|
|
||||||
<div *ngIf="environment.presidential">
|
<div *ngIf="environment.presidential">
|
||||||
<div *ngIf="calendars.Role == 'Presidente da República'"> PR </div>
|
<div *ngIf="calendars.Role == 'Presidente da República'"> PR </div>
|
||||||
<div *ngIf="calendars.Role == 'Ministro e Director do Gabinete do PR'"> MDGPR </div>
|
<div *ngIf="calendars.Role == 'Ministro e Director do Gabinete do PR'"> MDGPR </div>
|
||||||
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República' && calendars.Fullname"> Agenda do {{calendars.Fullname}} </div>
|
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República' && calendars.Fullname"> Agenda do {{calendars.Fullname}} </div>
|
||||||
<div *ngIf="calendars.Role != 'Presidente da República' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars == 'Meu calendario' ">
|
<div *ngIf="calendars.Role != 'Presidente da República' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars == 'Meu calendario' ">
|
||||||
<!-- <span *ngIf="SessionStore.user.Profile == 'PR' ">PR</span>
|
<!-- <span *ngIf="SessionStore.user.Profile == 'PR' ">PR</span>
|
||||||
<span *ngIf="SessionStore.user.Profile == 'MDGPR' ">MDGPR</span>
|
<span *ngIf="SessionStore.user.Profile == 'MDGPR' ">MDGPR</span>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
Minha agenda
|
Minha agenda
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!environment.presidential">
|
<div *ngIf="!environment.presidential">
|
||||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
||||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
||||||
@@ -82,14 +82,14 @@
|
|||||||
<mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
<mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
||||||
PR+MDGPR
|
PR+MDGPR
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="float-button">
|
<div class="float-button">
|
||||||
|
|
||||||
<button title="Visualizar a lista de Eventos para aprovação" class="cursor-pointer resize pr-20-rem" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
|
<button title="Visualizar a lista de Eventos para aprovação" class="cursor-pointer resize pr-20-rem" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showEventList" class="right-icons" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showEventList" class="right-icons" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</ion-row>
|
</ion-row>
|
||||||
<ion-row class="ion-align-items-center calendar-options">
|
<ion-row class="ion-align-items-center calendar-options">
|
||||||
|
|
||||||
@@ -217,16 +217,24 @@
|
|||||||
<div class="height-100">
|
<div class="height-100">
|
||||||
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}}" >
|
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}}" >
|
||||||
|
|
||||||
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
|
<!-- <div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
|
||||||
<div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
|
-->
|
||||||
<span >Hoje, </span> {{ timelineDate }}
|
|
||||||
</div>
|
<!-- <div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
|
||||||
|
<span >Hoje, </span> {{ timelineDate }}
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" style="
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
" >
|
||||||
|
|
||||||
|
|
||||||
<div *ngFor="let events of TimelineMDList | keyvalue; " >
|
<div *ngFor="let events of TimelineMDList | keyvalue; " >
|
||||||
|
|
||||||
<div class="EventListBox-container" >
|
<div class="EventListBox-container" >
|
||||||
<div class="day " [class.dayShow]="isSelectedDayHasEvent && hasEventToday" >
|
<div class="day " [class.dayShow]="isSelectedDayHasEvent && hasEventToday" >
|
||||||
{{ TimelineDay(events.key)}} <div style="text-transform: capitalize; display: inline;">{{ viewTitle }}</div>
|
{{ TimelineDay(events.key)}} <div style="text-transform: capitalize; display: inline;">{{ events.value[0].start | date: 'MMMM'}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngFor="let event of events.value" class="EventListBox mb-10" >
|
<div *ngFor="let event of events.value" class="EventListBox mb-10" >
|
||||||
|
|||||||
@@ -271,16 +271,19 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
if (realoadCounter != 0) {
|
if (realoadCounter != 0) {
|
||||||
|
|
||||||
if(this.currentMoth.rangeStartDate != null) {
|
|
||||||
|
|
||||||
this.loadRangeEvents(this.currentMoth.rangeStartDate, this.currentMoth.rangeEndDate)
|
|
||||||
} else {
|
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.updateEventListBox()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.calendar.currentDate = new Date();
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.myCal.update();
|
||||||
|
this.myCal.loadEvents();
|
||||||
|
this.onDropDownScrollWeal()
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
this.updateEventListBox()
|
||||||
|
|
||||||
realoadCounter++;
|
realoadCounter++;
|
||||||
this.weekToShow()
|
this.weekToShow()
|
||||||
}
|
}
|
||||||
@@ -735,7 +738,10 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt');
|
const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt');
|
||||||
if(this.TimelineMDList[selectedDay]) {
|
if(this.TimelineMDList[selectedDay]) {
|
||||||
this.hasEventToday = true
|
if(momentG(new Date(this.TimelineMDList[selectedDay][0].start), 'MMMM', 'pt') == momentG(this.eventSelectedDate, 'MMMM', 'pt')) {
|
||||||
|
this.hasEventToday = true
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.hasEventToday = false
|
this.hasEventToday = false
|
||||||
}
|
}
|
||||||
@@ -763,10 +769,7 @@ export class AgendaPage implements OnInit {
|
|||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
|
|
||||||
this.updateEventListBox()
|
this.updateEventListBox()
|
||||||
} else {
|
} else {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,10 +1153,8 @@ export class AgendaPage implements OnInit {
|
|||||||
// THIS LINE
|
// THIS LINE
|
||||||
this.updateEventListBox();
|
this.updateEventListBox();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
shoeEventDay(events: any[]) {
|
shoeEventDay(events: any[]) {
|
||||||
|
|
||||||
if (this.segment == 'Combinado') {
|
if (this.segment == 'Combinado') {
|
||||||
@@ -1171,3 +1172,18 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function endOfMonth(myDate){
|
||||||
|
let date = new Date(myDate);
|
||||||
|
date.setDate(1); // Avoids edge cases on the 31st day of some months
|
||||||
|
date.setMonth(date.getMonth() +1);
|
||||||
|
date.setDate(0);
|
||||||
|
date.setHours(23);
|
||||||
|
date.setMinutes(59);
|
||||||
|
date.setSeconds(59);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
const addDays = 5;
|
||||||
|
const endDateRange = endOfMonth(new Date(5))
|
||||||
|
endDateRange.setDate(endDateRange.getDate() + addDays)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import { DateService } from '../date.service';
|
|||||||
export class ListBoxService {
|
export class ListBoxService {
|
||||||
|
|
||||||
height = "unset"
|
height = "unset"
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dateService: DateService
|
private dateService: DateService
|
||||||
){}
|
){}
|
||||||
|
|
||||||
|
|
||||||
filterProfile(eventSource: EventListStore[] = [], profile: 'md' | 'pr' | 'all') {
|
filterProfile(eventSource: EventListStore[] = [], profile: 'md' | 'pr' | 'all') {
|
||||||
return eventSource.filter((e) => e.profile == profile)
|
return eventSource.filter((e) => e.profile == profile)
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ export class ListBoxService {
|
|||||||
getEventInsideRange(eventSource: EventListStore[], rangeStartDate, randEndDate) {
|
getEventInsideRange(eventSource: EventListStore[], rangeStartDate, randEndDate) {
|
||||||
return eventSource.filter((e)=> {
|
return eventSource.filter((e)=> {
|
||||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||||
new Date(randEndDate).getTime() >= new Date(e.endTime).getTime()) {
|
new Date(randEndDate).getTime() >= new Date(e.endTime).getTime()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -29,7 +29,7 @@ export class ListBoxService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filterSegment(eventSource: EventListStore[], segment): EventListStore[] {
|
filterSegment(eventSource: EventListStore[], segment): EventListStore[] {
|
||||||
|
|
||||||
return eventSource.filter( data => data.calendarName == segment)
|
return eventSource.filter( data => data.calendarName == segment)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,17 +39,17 @@ export class ListBoxService {
|
|||||||
|
|
||||||
// // filter range
|
// // filter range
|
||||||
// if(selectedDate) {
|
// if(selectedDate) {
|
||||||
// eventSource = eventSource.filter(data =>
|
// eventSource = eventSource.filter(data =>
|
||||||
// data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') &&
|
// data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') &&
|
||||||
// data.startTime.toLocaleDateString('pt') <= new Date(rangeStartDate).toLocaleDateString('pt')
|
// data.startTime.toLocaleDateString('pt') <= new Date(rangeStartDate).toLocaleDateString('pt')
|
||||||
// )
|
// )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
if(segment!='Combinado') {
|
if(segment!='Combinado') {
|
||||||
eventSource = this.filterSegment(eventSource, segment)
|
eventSource = this.filterSegment(eventSource, segment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(profile != 'all') {
|
// if(profile != 'all') {
|
||||||
// eventSource = this.filterProfile(eventSource, profile)
|
// eventSource = this.filterProfile(eventSource, profile)
|
||||||
// }
|
// }
|
||||||
@@ -59,8 +59,22 @@ export class ListBoxService {
|
|||||||
newStracture = this.encapsulation(eventSource);
|
newStracture = this.encapsulation(eventSource);
|
||||||
|
|
||||||
return this.display(newStracture, selectedDate)
|
return this.display(newStracture, selectedDate)
|
||||||
|
|
||||||
|
// console.log({daysObject})
|
||||||
|
|
||||||
|
// const daysStringNum = Object.keys(daysObject)
|
||||||
|
|
||||||
|
// for(const day of daysStringNum) {
|
||||||
|
// daysObject[day] = daysObject[day].reverse()
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// daysObject = this.transformObjectKeyOrder(daysObject, daysStringNum)
|
||||||
|
|
||||||
|
// return daysObject
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
display(list: CustomCalendarEvent[], selectedDate) {
|
display(list: CustomCalendarEvent[], selectedDate) {
|
||||||
let days = {};
|
let days = {};
|
||||||
|
|
||||||
@@ -74,8 +88,8 @@ export class ListBoxService {
|
|||||||
endTime: event.end
|
endTime: event.end
|
||||||
})
|
})
|
||||||
|
|
||||||
const day = this.dateService.getDay(event.start)
|
const day = this.dateService.getDay(event.start)
|
||||||
|
|
||||||
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
|
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
|
||||||
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
|
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
|
||||||
|
|
||||||
@@ -94,28 +108,28 @@ export class ListBoxService {
|
|||||||
if (diffDays >= 1) {
|
if (diffDays >= 1) {
|
||||||
|
|
||||||
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
|
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
|
||||||
|
|
||||||
if(this.CanPush(event, selectedDate)) days[day].push(StartEvent)
|
if(this.CanPush(event, selectedDate)) days[day].push(StartEvent)
|
||||||
|
|
||||||
let i = 1;
|
let i = 1;
|
||||||
|
|
||||||
// create event between date
|
// create event between date
|
||||||
while (startDate.getFullYear() != endDate.getFullYear() ||
|
while (startDate.getFullYear() != endDate.getFullYear() ||
|
||||||
startDate.getMonth() != endDate.getMonth() ||
|
startDate.getMonth() != endDate.getMonth() ||
|
||||||
startDate.getDate() != endDate.getDate()) {
|
startDate.getDate() != endDate.getDate()) {
|
||||||
|
|
||||||
const newDate = startDate.setDate(startDate.getDate()+ i)
|
const newDate = startDate.setDate(startDate.getDate()+ i)
|
||||||
let otherDays = this.dateService.getDay(newDate)
|
let otherDays = this.dateService.getDay(newDate)
|
||||||
|
|
||||||
event['other'] = true
|
event['other'] = true
|
||||||
|
|
||||||
event.start = newDate
|
event.start = newDate
|
||||||
if(!days.hasOwnProperty(otherDays)) {
|
if(!days.hasOwnProperty(otherDays)) {
|
||||||
|
|
||||||
days[otherDays] = []
|
days[otherDays] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(startDate.getFullYear() != endDate.getFullYear() ||
|
if (!(startDate.getFullYear() != endDate.getFullYear() ||
|
||||||
startDate.getMonth() != endDate.getMonth() ||
|
startDate.getMonth() != endDate.getMonth() ||
|
||||||
startDate.getDate() != endDate.getDate())) {
|
startDate.getDate() != endDate.getDate())) {
|
||||||
// last push
|
// last push
|
||||||
@@ -128,7 +142,9 @@ export class ListBoxService {
|
|||||||
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true})
|
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true})
|
||||||
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
|
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
days[otherDays] = days[otherDays].reverse()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -143,7 +159,7 @@ export class ListBoxService {
|
|||||||
if(this.CanPush(event, selectedDate) && diffDays != 2) days[day].push(event)
|
if(this.CanPush(event, selectedDate) && diffDays != 2) days[day].push(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -162,9 +178,13 @@ export class ListBoxService {
|
|||||||
|
|
||||||
CanPush(event: any, selectedDate: Date) {
|
CanPush(event: any, selectedDate: Date) {
|
||||||
|
|
||||||
return new Date(event.start).getMonth() == selectedDate.getMonth() &&
|
const limite = this.endOfMonth(selectedDate)
|
||||||
new Date(event.start).getFullYear() == selectedDate.getFullYear() &&
|
limite.setDate(limite.getDate() + 10)
|
||||||
new Date(event.start).getDate() >= selectedDate.getDate()
|
|
||||||
|
return new Date(event.start).getFullYear() >= selectedDate.getFullYear() &&
|
||||||
|
new Date(event.start).getMonth() >= selectedDate.getMonth() &&
|
||||||
|
new Date(event.start).getTime() >= selectedDate.getTime() &&
|
||||||
|
new Date(event.start).getTime() <= limite.getTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
encapsulation(eventsList:EventListStore[]): CustomCalendarEvent[] {
|
encapsulation(eventsList:EventListStore[]): CustomCalendarEvent[] {
|
||||||
@@ -173,7 +193,7 @@ export class ListBoxService {
|
|||||||
let events: CustomCalendarEvent[] = [];
|
let events: CustomCalendarEvent[] = [];
|
||||||
|
|
||||||
eventsList.forEach((element, eventIndex) => {
|
eventsList.forEach((element, eventIndex) => {
|
||||||
|
|
||||||
events.push({
|
events.push({
|
||||||
start: new Date(element.startTime),
|
start: new Date(element.startTime),
|
||||||
end: new Date(element.endTime),
|
end: new Date(element.endTime),
|
||||||
@@ -209,4 +229,36 @@ export class ListBoxService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
transformObjectKeyOrder(originalObject, keyOrder) {
|
||||||
|
const transformedObject = {};
|
||||||
|
|
||||||
|
for (const key of keyOrder) {
|
||||||
|
if (originalObject.hasOwnProperty(key)) {
|
||||||
|
transformedObject[key] = originalObject[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include any remaining keys not in the specified order
|
||||||
|
for (const key in originalObject) {
|
||||||
|
if (!keyOrder.includes(key) && originalObject.hasOwnProperty(key)) {
|
||||||
|
transformedObject[key] = originalObject[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return transformedObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
endOfMonth(myDate){
|
||||||
|
let date = new Date(myDate);
|
||||||
|
date.setDate(1); // Avoids edge cases on the 31st day of some months
|
||||||
|
date.setMonth(date.getMonth() +1);
|
||||||
|
date.setDate(0);
|
||||||
|
date.setHours(23);
|
||||||
|
date.setMinutes(59);
|
||||||
|
date.setSeconds(59);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user