Skip to content

Commit a57fafd

Browse files
Update components/trustpilot/sources/new-service-reviews/new-service-reviews.mjs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent e77c5ab commit a57fafd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

components/trustpilot/sources/new-service-reviews/new-service-reviews.mjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ export default {
6666
}
6767

6868
// Emit reviews (already parsed by the action)
69-
let latestReviewTime = lastReviewTime;
69+
let latestReviewTime = lastReviewTime;
7070

71-
for (const review of reviews) {
72-
// Track the latest review time
73-
if (!latestReviewTime || review.createdAt > latestReviewTime) {
74-
latestReviewTime = review.createdAt;
75-
}
71+
for (const review of reviews) {
72+
// Track the latest review time
73+
const reviewTime = new Date(review.createdAt).toISOString();
74+
if (!latestReviewTime || new Date(reviewTime) > new Date(latestReviewTime)) {
75+
latestReviewTime = reviewTime;
76+
}
77+
}
7678

7779
// Emit the review with unique ID and summary
7880
this.$emit(review, {

0 commit comments

Comments
 (0)