⛄ Snowberb ⛄ – 10-46 Jun 1
I'm trying to get the Max and the Min dates from an array of objects, but im having some problems. This is what I've done:
startDate: new Date(Math.max(...bonuses.map((bonus) => new Date(bonus.fecha_evento))))
The problem is that typescript is telling me Argument of type 'Date' is not assignable to parameter of type 'number'
How can I get the min and the max dates from an array of objects?5 Replies
what is
bonus.fecha_evento
value exactly?a string
I just fixed it
using
getTime()
thank you for answering my question tho <3hmm, i think it's weird TS yells about not assignable number parameter if you passed string there 🤔
yeah that's what I also thought
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/981508938396758066