Files
Owlerlay/src/features/countdown/model/countdown.mapper.ts
s0wlz (Matthias Puchstein) adfdc5b31a [refactor] updated the API
TODO: implement the countdown.store.ts

Signed-off-by: s0wlz (Matthias Puchstein) <matthias@puchstein.lu>
2026-02-27 22:15:21 +01:00

14 lines
684 B
TypeScript

import type {CountdownSnapshot, CountdownSnapshotDto} from "./countdown.types";
import {type Duration, millisToDuration} from "../../../shared/time/duration";
export function mapSnapshotDtoToSnapshot(snapshotDto: CountdownSnapshotDto): CountdownSnapshot {
const duration: Duration = millisToDuration(snapshotDto.duration);
return {
id: snapshotDto.id,
label: snapshotDto.label,
duration: duration,
state: snapshotDto.state,
start_epoch: snapshotDto.start_epoch_ms !== null ? new Date(snapshotDto.start_epoch_ms) : null,
target_epoch: snapshotDto.target_epoch_ms !== null ? new Date(snapshotDto.target_epoch_ms) : null,
};
}