geomon.viewer/src/shared/models/timespan.ts

30 lines
664 B
TypeScript
Raw Normal View History

export abstract class TimeInterval {
}
export class Timespan extends TimeInterval{
public from: number;
public to: number;
constructor(from: number | Date, to?: number | Date) {
super();
this.from = from instanceof Date ? from.valueOf() : from;
this.to = to ? (to instanceof Date ? to.valueOf() : to) : this.from;
}
}
export class BufferedTime extends TimeInterval {
public timestamp: Date;
public bufferInterval: number;
constructor(
timestamp: Date,
bufferInterval: number
) {
super();
this.timestamp = timestamp;
this.bufferInterval = bufferInterval;
}
}