Generic Commit; Most likely a fix or small feature
This commit is contained in:
@@ -23,3 +23,9 @@ export interface HomeAssistantDeskPositionResult {
|
||||
asBoolean: boolean;
|
||||
asText: () => string;
|
||||
}
|
||||
|
||||
export type API_HA_DeskPosition = {
|
||||
position: string;
|
||||
isStanding: boolean;
|
||||
standingTime: string;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,18 @@ export class TimeSpan {
|
||||
}
|
||||
}
|
||||
|
||||
export function calculateSecondsBetween(
|
||||
start: number,
|
||||
end: number,
|
||||
): { seconds: number; toReadable: (roundToMinutes?: boolean) => string } {
|
||||
const seconds = Math.max(60, (end - start) / 1000);
|
||||
return {
|
||||
seconds,
|
||||
toReadable: (roundToMinutes?: boolean) =>
|
||||
secondsToReadable(seconds, roundToMinutes),
|
||||
};
|
||||
}
|
||||
|
||||
export function secondsToReadable(
|
||||
secs: number,
|
||||
roundToMinutes: boolean = false,
|
||||
|
||||
Reference in New Issue
Block a user