I'm building a schedule calendar in React and wondering what's the best way to extract a key from a js Date
object? I'm already using the date-fns library but haven't seen anything about ids in their documentation.
to be clear, each date only appears once in the list so I'm looking for the fastest way to get a unique key out of a date, without using the object reference.
So far I'm using date.valueOf()
or format(date, 'yyyy-mm-dd')
although I feel that might be overkill since it might be recalculated every render.