Skip to content

Commit

Permalink
Fix timer on safari
Browse files Browse the repository at this point in the history
  • Loading branch information
Atlinx committed Nov 27, 2024
1 parent e3224d2 commit cb2a104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class ScarletGameJamPageComponent implements OnInit {
getSemesterString = getSemesterString;

ngOnInit(): void {
let startDateTimeStart = convertHourMinute12to24(this.startDateTime.split('-')[0]);
let startDateObj = new Date(this.startDate + ', ' + new Date().getFullYear() + ' ' + startDateTimeStart + ' EST');
let startDateTime24Hr = convertHourMinute12to24(this.startDateTime.split('-')[0]);
let startDateObj = new Date(this.startDate + ', ' + new Date().getFullYear() + ' ' + startDateTime24Hr + ' EST');
this.eventActive = startDateObj < new Date();
let finalDateSeconds = startDateObj.getTime() / 1000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AfterViewInit, Component } from '@angular/core';
import { BreakpointManagerService } from '@app/services/breakpoint-manager.service';
import { getSemesterString } from '@src/app/utils/duration-utils';
import { convertHourMinute12to24, getSemesterString } from '@src/app/utils/duration-utils';
import { SettingsService } from '@src/_settings';
declare var FlipDown: any;

Expand All @@ -14,7 +14,7 @@ declare var FlipDown: any;
})
export class ScarletShowcasePageComponent implements AfterViewInit {
startDate: string = 'Dec 8';
startTime: string = '5pm';
startTime: string = '5:00 pm';

eventActive: boolean = false;

Expand All @@ -25,9 +25,11 @@ export class ScarletShowcasePageComponent implements AfterViewInit {
getSemesterString = getSemesterString;

ngAfterViewInit(): void {
let startTime24Hr = convertHourMinute12to24(this.startTime);
if (!this.eventActive) {
var finalDateSeconds =
new Date(this.startDate + ', ' + new Date().getFullYear() + ' ' + this.startTime + ' EST').getTime() / 1000;
new Date(this.startDate + ', ' + new Date().getFullYear() + ' ' + startTime24Hr + ' EST').getTime() / 1000;
console.log('using file seconds: ', finalDateSeconds);
var flipdown = new FlipDown(finalDateSeconds, 'sgj-countdown', {
theme: 'dark',
}).start();
Expand Down

0 comments on commit cb2a104

Please sign in to comment.