Skip to content

Commit

Permalink
use real time for heats and incidents
Browse files Browse the repository at this point in the history
  • Loading branch information
konrad2002 committed Oct 24, 2024
1 parent edd809a commit c5c4e17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 5 additions & 1 deletion src/app/core/function/date.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export function createDatePlusOne(s: string): Date {
}

export function createDateFromUTC(s: string): Date {
return new Date(s);
}

export function createDateForBerlin(s: string): Date {
let d = new Date(s);
return d;
return convertTZ(d, "Europe/Berlin");
}

//https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript
Expand Down
6 changes: 3 additions & 3 deletions src/app/core/model/meeting/incident.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createDate} from "../../function/date.functions";
import {createDateForBerlin} from "../../function/date.functions";

export interface Incident {
_id: string;
Expand Down Expand Up @@ -36,11 +36,11 @@ export class IncidentImpl {
}

public getStartDate(): Date {
return createDate(this.start);
return createDateForBerlin(this.start);
}

public getEndDate(): Date {
return createDate(this.end)
return createDateForBerlin(this.end)
}

public getStartTimeString(): string {
Expand Down
14 changes: 5 additions & 9 deletions src/app/core/model/start/heat.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createDate, createDateFromUTC, createDatePlusOne} from "../../function/date.functions";
import {createDateForBerlin} from "../../function/date.functions";

export interface Heat {
_id: string;
Expand Down Expand Up @@ -36,7 +36,7 @@ export class HeatImpl implements Heat {
}

getEstimatedStart(): Date {
return createDate(this.start_estimation);
return createDateForBerlin(this.start_estimation);
}

getEstimatedStartTime(): string {
Expand All @@ -46,15 +46,11 @@ export class HeatImpl implements Heat {
}

getStartDelayEstimation(): Date {
if (this.getStartAt().getTime() > 1000) {
return createDateFromUTC(this.start_delay_estimation);
} else {
return createDatePlusOne(this.start_delay_estimation)
}
return createDateForBerlin(this.start_delay_estimation);
}

getFinishedAt(): Date {
return createDateFromUTC(this.finished_at);
return createDateForBerlin(this.finished_at);
}

getFinishedAtTime(): string {
Expand All @@ -76,7 +72,7 @@ export class HeatImpl implements Heat {
}

getStartAt(): Date {
return createDateFromUTC(this.start_at);
return createDateForBerlin(this.start_at);
}

getStartAtTime(): string {
Expand Down

0 comments on commit c5c4e17

Please sign in to comment.