Do not wasted time with native Date, use date-fns
and go home!
import { format, lastDayOfMonth } from 'date-fns'
const today = new Date()
const firstDateOfMonth = format(today, 'yyyy-MM-01')
const lastDateOfMonth = format(lastDayOfMonth(today), 'yyyy-MM-dd')
Now go home!
Top comments (1)
This post is like a flash of insight! It's short, clear, and gets right to the point. No extra stuff to bog you down. Time to call it a day and head home!