1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:16:40 -04:00

more optimization/error handling

This commit is contained in:
2022-04-22 09:18:53 -04:00
parent 831139c132
commit 8a97b706be
12 changed files with 93 additions and 72 deletions

View File

@ -2,7 +2,6 @@ import { NextSeo } from "next-seo";
import Content from "../../components/Content";
import NotesList, { NotesListProps } from "../../components/NotesList";
import { getAllNotes } from "../../lib/helpers/parse-notes";
import { formatDateTZ } from "../../lib/helpers/format-date";
import type { GetStaticProps } from "next";
const Notes = ({ notesByYear }: NotesListProps) => (
@ -26,7 +25,7 @@ export const getStaticProps: GetStaticProps = async () => {
const notesByYear: NotesListProps["notesByYear"] = {};
getAllNotes().map((note) => {
const year = formatDateTZ(note.date, "yyyy");
const year = new Date(note.date).getUTCFullYear();
(notesByYear[year] || (notesByYear[year] = [])).push(note);
});