Creating whole Band details page

This commit is contained in:
2024-09-29 16:56:43 +02:00
parent 422a5e1722
commit f898c0c5b9
16 changed files with 294 additions and 111 deletions

View File

@@ -32,6 +32,22 @@ export function calcRating(ratings: Array<RatingModel>) {
return sum / ratings.length
}
export function calcRatingValues(ratings: Array<RatingModel>) {
let ratingValues = [
{ value: 1, count: 0 },
{ value: 2, count: 0 },
{ value: 3, count: 0 },
{ value: 4, count: 0 },
{ value: 5, count: 0 }
]
for (let rating of ratings) {
ratingValues[rating.rating - 1].count += 1
}
return ratingValues
}
export function createDateRangeString(tour: TourModel) {
const dateArray = []

View File

@@ -2,4 +2,8 @@ export function dateToHumanReadableString(date: Date) {
return String(date.getDate()).padStart(2, '0') + '.' +
String(date.getMonth() + 1).padStart(2, '0') + '.' +
date.getFullYear()
}
export function dateStringToHumanReadableString(string: string) {
return dateToHumanReadableString(new Date(string))
}