diff --git a/vinoa-web/lib/utils/helperFunctions.ts b/vinoa-web/lib/utils/helperFunctions.ts index a819c9a..7a6c246 100644 --- a/vinoa-web/lib/utils/helperFunctions.ts +++ b/vinoa-web/lib/utils/helperFunctions.ts @@ -3,18 +3,20 @@ const getCurrentMonthAsRange = () => { start.setDate(1); let end = new Date(start); end.setMonth(end.getMonth() + 1); - + let from = start.toISOString(); + from = from.substring(0, from.indexOf('T')); let to = end.toISOString(); + to = to.substring(0, to.indexOf('T')); return { from, to }; -} +}; -const getAverageRating= (reviews: Review[]) => { - let sum =0 +const getAverageRating = (reviews: Review[]) => { + let sum = 0; reviews.forEach((review) => { sum += review.rating; }); return sum / reviews.length; -} -export { getAverageRating , getCurrentMonthAsRange}; \ No newline at end of file +}; +export { getAverageRating, getCurrentMonthAsRange };