33 lines
718 B
TypeScript
33 lines
718 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.
|
|
*/
|
|
export class UpcomingRaceCardViewModel {
|
|
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',
|
|
});
|
|
}
|
|
}
|