Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt. roe.dev
Something went wrong. Try again.
224 B · 5 lines
TypeScript
123456export const formatDateField = <T extends { date: string }>(item: T) => { const d = new Date(item.date) const formattedDate = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}` return { ...item, formattedDate }}