Files
gridpilot.gg/apps/website/lib/view-models/UpcomingRaceCardViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

35 lines
801 B
TypeScript

interface UpcomingRaceCardDTO {
id: string;
track: string;
car: string;
scheduledAt: string;
}
/**
* Upcoming race card view model
* UI representation of an upcoming race on the landing page.
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
export class UpcomingRaceCardViewModel extends ViewModel {
readonly id: string;
readonly track: string;
readonly car: string;
readonly scheduledAt: string;
constructor(dto: UpcomingRaceCardDTO) {
this.id = dto.id;
this.track = dto.track;
this.car = dto.car;
this.scheduledAt = dto.scheduledAt;
}
/** UI-specific: formatted date label */
get formattedDate(): string {
return new Date(this.scheduledAt).toLocaleDateString(undefined, {
month: 'short',
day: 'numeric',
});
}
}