diff options
Diffstat (limited to 'src/utils/helpers/sort.ts')
| -rw-r--r-- | src/utils/helpers/sort.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/utils/helpers/sort.ts b/src/utils/helpers/sort.ts index ade82d0..c1ee35d 100644 --- a/src/utils/helpers/sort.ts +++ b/src/utils/helpers/sort.ts @@ -10,7 +10,9 @@ export const sortPostsByYear = (data: PostsList[]) => { data.forEach((page) => { page.posts.forEach((post) => { - const postYear = new Date(post.date.publication).getFullYear().toString(); + const postYear = new Date(post.dates.publication) + .getFullYear() + .toString(); yearCollection[postYear] = [...(yearCollection[postYear] || []), post]; }); }); |
