This commit is contained in:
2024-11-29 19:05:15 -06:00
parent d9be33b52b
commit 3e08ffdfd7
10 changed files with 47 additions and 53 deletions
+4 -4
View File
@@ -6,10 +6,10 @@ import { TimezoneService } from './timezone/services/timezone.service';
declare let gtag: Function;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false,
})
export class AppComponent {
fiveOclocks: Timezone[] = [];
+3 -5
View File
@@ -3,14 +3,12 @@ import { Injectable } from '@angular/core';
declare let gtag: Function;
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class GoogleAnalyticsService {
constructor() { }
constructor() {}
public emitEvent(name: string, event: any) {
gtag('event', name, event)
gtag('event', name, event);
}
}
@@ -3,22 +3,28 @@ import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/cor
import { Timezone } from '../../models/timezone.model';
@Component({
selector: 'app-timezone-list',
templateUrl: './timezone-list.component.html',
styleUrls: ['./timezone-list.component.scss'],
animations: [
trigger('displayState', [
state('show', style({
opacity: 1,
})),
state('hide', style({
opacity: 0,
})),
transition('show=>hide', animate('450ms ease-out')),
transition('hide=>show', animate('450ms ease-in')),
]),
],
standalone: false
selector: 'app-timezone-list',
templateUrl: './timezone-list.component.html',
styleUrls: ['./timezone-list.component.scss'],
animations: [
trigger('displayState', [
state(
'show',
style({
opacity: 1,
})
),
state(
'hide',
style({
opacity: 0,
})
),
transition('show=>hide', animate('450ms ease-out')),
transition('hide=>show', animate('450ms ease-in')),
]),
],
standalone: false,
})
export class TimezoneListComponent implements OnInit, OnChanges {
@Input() timezones: Timezone[] = [];
+10 -13
View File
@@ -3,39 +3,36 @@ import { DateTime } from 'luxon';
import { Timezone, TimezoneCompare, TimezoneList } from '../models/timezone.model';
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class TimezoneService {
constructor() {}
constructor() { }
public getCurrentTimezone() : string | null {
return DateTime.now().zoneName
public getCurrentTimezone(): string | null {
return DateTime.now().zoneName;
}
public getTimezones(): string[] {
return TimezoneList()
return TimezoneList();
}
public getCurrentTimeForTimezone(timezone: string): DateTime | null {
var dateTime = DateTime.local().setZone(timezone)
var dateTime = DateTime.local().setZone(timezone);
return dateTime.isValid ? dateTime : null;
}
public getCurrentTimeInTimezones(timezones: string[]): Timezone[] {
var dates: Timezone[] = [];
timezones.forEach(element => {
timezones.forEach((element) => {
var date = this.getCurrentTimeForTimezone(element);
if (date != null) {
const timezone = { name: element, time: date }
dates.push(timezone)
const timezone = { name: element, time: date };
dates.push(timezone);
}
});
return dates.sort(TimezoneCompare);
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
export const environment = {
production: true
production: true,
};
+1 -1
View File
@@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
};
/*