mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
ITOTEAM-530 Inform the user how many days are left until the end of the wind for each selected day
This commit is contained in:
@@ -97,13 +97,13 @@ export class EditEventPage implements OnInit {
|
||||
SessionStore= SessionStore
|
||||
|
||||
CalendarNameOwnerName = ''
|
||||
CalendarNamesOptions = []
|
||||
allDayCheck: boolean = false;
|
||||
addedAttachmentsList = [];
|
||||
|
||||
sharedCalendar: Observable<TableSharedCalendar[]>
|
||||
hasChangeCalendar = false
|
||||
selectedUserCalendar:any;
|
||||
CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -133,10 +133,10 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log('this.postEvent', this.postEvent)
|
||||
|
||||
this.selectedUserCalendar = this.postEvent.owner.wxUserId
|
||||
this.loadedEventAttachments = this.postEvent.Attachments
|
||||
console.log(this.postEvent.Category)
|
||||
|
||||
this._postEvent = this.postEvent
|
||||
this._postEvent.Category = this.setEventType(this._postEvent.Category)
|
||||
if (!this._postEvent.IsRecurring) {
|
||||
|
||||
@@ -90,6 +90,9 @@
|
||||
<span *ngIf="!loadedEvent.IsRecurring">(Não se repete)</span>
|
||||
</p>
|
||||
|
||||
<!-- <p >
|
||||
{{ daysToEnd }} dias para terminar o evento
|
||||
</p> -->
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -57,6 +57,7 @@ export class ViewEventPage implements OnInit {
|
||||
sesseionStora = SessionStore
|
||||
|
||||
TimeZoneString = ''
|
||||
daysToEnd = 0
|
||||
|
||||
constructor(
|
||||
public eventsService: EventsService,
|
||||
@@ -79,9 +80,35 @@ export class ViewEventPage implements OnInit {
|
||||
this.eventBody = { BodyType : "1", Text : ""};
|
||||
this.loadedEvent.Body = this.eventBody;
|
||||
|
||||
console.log()
|
||||
}
|
||||
|
||||
|
||||
daysToEndWithJS(startDateStr: any, endDateStr: any) {
|
||||
// Define the start and end dates
|
||||
const startDate: any = new Date(startDateStr);
|
||||
const endDate: any = new Date(endDateStr);
|
||||
|
||||
// Calculate the difference in milliseconds between the two dates
|
||||
const differenceMs = Math.abs(endDate - startDate);
|
||||
|
||||
// Convert milliseconds to days
|
||||
const millisecondsPerDay = 1000 * 60 * 60 * 24;
|
||||
const differenceDays = Math.ceil(differenceMs / millisecondsPerDay);
|
||||
|
||||
console.log(`Number of days between the dates: ${differenceDays}`);
|
||||
|
||||
return differenceDays
|
||||
|
||||
}
|
||||
|
||||
deferenceBetweenDays(start: any, end: any) {
|
||||
start.setHours(0, 0, 0, 0);
|
||||
end.setHours(0, 0, 0, 0);
|
||||
const diffTime = Math.abs(end - start);
|
||||
return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.loadEvent();
|
||||
@@ -137,11 +164,23 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
if(res.isOk()) {
|
||||
|
||||
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
||||
this.loadedEvent = res.value as any;
|
||||
console.log('this.loadedEvent', this.loadedEvent)
|
||||
|
||||
if(new Date().getTime() <= new Date(this.loadedEvent.EndDate).getTime()) {
|
||||
if(this.deferenceBetweenDays(new Date(), new Date(this.loadedEvent.EndDate))) {
|
||||
this.daysToEnd = this.daysToEndWithJS(new Date(this.loadedEvent.StartDate), new Date(this.loadedEvent.EndDate))
|
||||
} else {
|
||||
this.daysToEnd = 0
|
||||
}
|
||||
} else {
|
||||
this.daysToEnd = 0
|
||||
}
|
||||
|
||||
this.setTimeZone()
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user