From 58488e207d4ab2d39a8497c1596954c28e4f3c68 Mon Sep 17 00:00:00 2001 From: "Luke J. Westfall" Date: Thu, 4 Jan 2024 18:20:20 -0500 Subject: [PATCH] fix: meeting countdown doesn't calculate until +1s --- .../meeting-countdown/meeting-countdown.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Client/src/app/meetings/meeting-countdown/meeting-countdown.component.ts b/src/Client/src/app/meetings/meeting-countdown/meeting-countdown.component.ts index ed63ec8..2aee581 100644 --- a/src/Client/src/app/meetings/meeting-countdown/meeting-countdown.component.ts +++ b/src/Client/src/app/meetings/meeting-countdown/meeting-countdown.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnDestroy } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import moment from 'moment'; import { MeetingDto } from '../../api/models'; @@ -7,12 +7,16 @@ import { MeetingDto } from '../../api/models'; templateUrl: './meeting-countdown.component.html', styleUrls: ['./meeting-countdown.component.css'], }) -export class MeetingCountdownComponent implements OnDestroy { +export class MeetingCountdownComponent implements OnInit, OnDestroy { @Input({ required: true }) meeting!: MeetingDto; nextMeetingStr?: string; - timeUntilMeetingInterval: NodeJS.Timeout; + timeUntilMeetingInterval?: NodeJS.Timeout; + + constructor() {} + + ngOnInit(): void { + this.nextMeetingStr = this.timeUntilMeeting(); - constructor() { this.timeUntilMeetingInterval = setInterval(() => { this.nextMeetingStr = this.timeUntilMeeting(); }, 1000);